Tuesday, October 20, 2009

windows: how to schedule a high-frequency task

Task Scheduler doesn't let you schedule tasks with fine-grained frequencies. For example, you can't schedule a task to execute every minute, or every few hours. The maximum frequency that can be given to a task is "daily" which sucks because you need to run some programs more often than that (linux's cron is still the king!)

Here's the solution. It involves using the rather powerful "schtasks" windows command:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true

Here's what I used:
schtasks /create /sc hourly /mo 2 /tn "autoupdatesourcecode" /tr c:\tools\autoupdatesourcecode.bat


And this is my super-simple autoupdatesourcecode.bat:
cd d:\Codebase\trunk\pi\
d:
svn up

No comments: