问题
I just setup cron on my windows dev system in order to perform an hourly run of a script.
I tried to edit crontab in order to run my script hourly, sadly with no success.
Could anyone pls. drop me the crontab line which will execute script.xy every hour?
回答1:
If you're using Windows, why not use the built-in Scheduled Tasks (Accessories-System Tools)?
It may not show up immediately in the Wizard, but it is possible to set up tasks to be run hourly. Just add a daily task and then tick the "Open Advanced Properties" checkbox. Then go to the Schedule tab and again click "Advanced".
回答2:
I figured it out: 0 * * * * C:\doSomeWork.script Makes the script run every full hour. Sometimes the easy way is the best... ;) thx anyway
回答3:
I'd argue you probably don't want to be using Cron on Windows at all. Instead use a Scheduled Task (accessible through the Control Panel) and select your script.
Alternatively create a Windows service which runs your program hourly. I've never heard of people using Cron for Windows tasks in this way.
回答4:
Can't you use the Windows Task Scheduler instead of crontab? A commandline solution would look something like:
at 00:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
at 01:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
...
Notice that you have to schedule a new task for each hour. Anyone got a better soluition for this using the at command?
来源:https://stackoverflow.com/questions/1192580/hourly-cronjob-on-windows