This page describes how to add a scheduled task to
Windows. It shows Windows XP (slightly edited), but the principles apply
to all versions of Windows. As an example, we want to add a task to update
some statistics every 30 minutes, and we want the task to run at 5 minutes and
35 minutes past the hour. It is assumed that you have already written and
tested a command (batch) file which contains all the commands you need to run to
perform the required task, and that this file is named UpdateMrtgStats.cmd. Using
this information as a guide, you can also add scheduled tasks to Windows Vista
and Windows-7. Rather than re-invent the wheel, I point to some external
references: http://windows.microsoft.com/en-US/windows7/schedule-a-task or
with screen-shots:
http://www.sevenforums.com/tutorials/12444-task-scheduler-create-new-task.html Start
the Windows Control Panel
Start button, Control Panel. Select Scheduled
Tasks. You should get a list of the existing tasks (e.g.
AppleSoftwareUpdate in the screenshot below) and an Add Scheduled Task
option. Double-click on Add Scheduled Task.
This should invoke the Scheduled Task Wizard...
Click Next.
The wizard will prompt you which program you want to run. However, as
you want to run your own command script, click Browse to allow you to
locate your command file.
Select your command file and click Open.
You now need to tell the computer when to run this task. In this case,
you want the task to run every day, and at 30-minute intervals during the
day. At this point, we can define the "daily" part of the
schedule, and the 30-minute part will come later. Select Daily and
click Next.
We now need to define the start time for the task. Change the Start time
field to 00:05. This will run the task at five minutes past
midnight. There are other options such as only running on weekdays etc.
but we don't need those. Click Next.
We are now required to give the user name an password to run the task.
Once this is done, click Next.
That completes creating the task, although we still need to set the 30-minute
repeat. To do this right away, make sure that the "Open advanced..."
box is checked. If you forget to do this, you can always right-click the task
and select Properties to edit these details later. Click Finish.
You now see the schedule you have already created - daily at 00:05.
Click Advanced.
Now you can click on the Repeat task box, which
enables the settings in the box. The Every setting should be
changed to 30 minutes (or whatever interval you want). As you want
the task to repeat throughout the whole 24 hours, in the Duration
field, select 24 hours. Click OK.
You are now back with the main Properties, Schedule
dialog and you can now see that the task is shown as repeating every 30
minutes.
And that's it! |