I recently started to work with Microsoft Windows Server 2008 (IIS7) and I have detected some really cool command line tricks:
ForFiles
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:
forfiles /?
Schtasks
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
another example:
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:
schtasks /?
and is also available at:
http://technet.microsoft.com/en-us/library/cc725744(WS.10).aspx
Please let me know if you know other, really useful command line tricks that I can use under Windows Server 2008 !
