Did you ever need to schedule some task to run once in a while on a server? If you did, you noticed that Linux servers have a great tool called cron which is quite simple to use, but what if you have a Windows server? Of course Windows does not have cron, but I’m sure someone out there thought about it and wrote some application to emulate it. In the meanwhile, Windows also provides the Task Scheduler
This is what you need to do in order to create a Scheduled Task (CronJob):
1. Open Scheduler
2. Go to Start > Programs > Accessories > System Tools > Scheduled Tasks
3. Double-click Add Scheduled Task
4. The Scheduled Task Wizard will appear. Click Next.
5. Select the program to run. Choose your browser from the list (for example, Internet Explorer or Mozilla Firefox). Click Next.
5. Give the task a Name, such as WindowsCronJob, and choose the Frequency with which to perform the task (for example, Daily)). Click Next.
6. Choose date and time options. Click Next.
7. Enter your password if prompted. Change the username if required (for example, you’d like the task to run under a user with fewer privileges security reasons). Click Next.
8. On the final page, select the checkbox Open advanced properties for this task when I click Finish and click Finish.
And then, we need to configure the “CronJob”
1. Go to the task’s setting page either by checking the checkbox at the end of the last step, or by double-clicking on the task.
2. In the Run box, after the text that is there now (for example, C:\PROGRA~1\MOZILL~1\firefox.exe), enter a space and then type the address to your website’s task.php page in double quotations for example:
3. To set a frequency more often than Daily (for example, hourly), click the Schedule tab, then click Advanced. Here you can set options such as Repeat task, every 1 hour for 23 hours. Click Ok when finished.
4. Change the start time on the task to one minute from the current time. This will allow you to test the task and make sure that it is working.
5. When everything has been configured to match your needs, click Apply and OK
I’m not a windows guru, so if I made any mistakes around, please feel free to correct me 😉