I recently started to work with Microsoft Windows Server 2008 (IIS7) and I have detected some really cool command line tricks:
Use ForFiles to delete files older than (for example) two days:
Forfiles /P C:\Downloads\ /S /M *.jpg /D -2 /C "cmd /C del /Q @path"
More information about ForFiles is available using this command:
Use Schtasks to schedule tasks from the command line. For example, create a scheduled task that runs every hour:
schtasks /create /tn "Name of the task" /tr run this command /sc HOURLY
create a scheduled task that runs every day at a specific time:
schtasks /create /tn "My script" /tr C:\Users\Administrator\MyScripts\myscript.bat /sc daily /st 08:00
The scheduled task shows up in Windows Task Manager (library). More information about schtasks is available using this command:
and is also available at:
Please let me know if you know other, really useful command line tricks that I can use under Windows Server 2008 !