Though not of much use for the average user, the ability to schedule tasks on your computer can be of much use to a power user.
My goal was to schedule an hourly task on my Windows XP laptop. I started in the Control Panel under "Scheduled Tasks". I clicked on "Add Scheduled Task", then clicked "Next" waited for about a minute while my computer searched for applications it thinks I might want to schedule. At the "Scheduled Task Wizard", I clicked "Browse" and chose the executable file that I wanted to schedule. In the Next window, I can rename the task if I want (I didn't) and then I get to choose from:
- Daily
- Weekly
- Monthly
- One time only
- When my computer starts
- When I log on
Guess what's missing...that's right an "Hourly" selection. Anyway, thinking I might have the ability to modify the period of the task, I clicked "Daily" and Next. At the next window you can choose the Start Time and Date and whether you want Every Day, Weekdays or every Nth day.
Being the intrepid explorer that I am, I clicked on "Every day" and planned to start the task immediately. After entering my user name and confirming my password I proceeded to the next screen where I noticed a checkbox that titled "Open advanced properties for this task when I click Finish". Maybe I'm in luck? I checked that box and clicked "Finish".
What comes up is a dialog box describing my task with 4 tabs (Task, Schedule, Settings and Security). Going to the "Schedule" tab I see my task is scheduled to run Daily but there is an "Advanced" button. Clicking on that reveals that a new dialog box with a "Repeat task" checkbox that is unchecked. Checking it enables a new series of controls wherein I can modify the task to repeat every N minutes or hours. Beauty! Modify to run every 1 hour and away we go!
Now bear in mind that the above steps is not what I actually did. When I set up the task the first time I totally missed the "Open advanced properties for this task when I click Finish" checkbox. So I did some googling and found out that the Task Scheduler in Control Panel is actually a GUI wrapper around the Windows system command "schtasks" (pronounced "shit asks" ??). The following are steps that I took when playing with schtasks but there are a myriad of options for this tool and likely this will only prove to be a surface level primer on it for the brave at heart:
- open a Command Prompt
[size=18][u][b]Listing Your Tasks[/b][/u][/size]
- type schtasks. All tasks that you currently have scheduled will be listed with their next run times
[size=18][u][b]Deleting a Tasks[/b][/u][/size]
- now I want to remove my daily task that I added using the Control Panel's applet. To do that, type:
[code:1]
schtasks /delete /tn "MyTaskName"
[/code:1]
Where MyTaskName should be substituted for whatever task you want to remove. A warning will come up saying "Are you sure you want to remove the task (Y/N )?". Typing y will successfully remove the task.
[size=18][u][b]Adding an Hourly Task[/b][/u][/size]
- now I want to add a task that will run an executable hourly. This is what you type:
[code:1]
schtasks /create /sc hourly /tn MyTaskName /tr c:\MyExecutable.exe
[/code:1]
The command will prompt you for your password and given that successful entry, the task will be added. You can verify this by using "schtasks" or the more complex schtasks /query command.
[size=18][u][b]Getting Help with schtasks[/b][/u][/size]
- as with most system commands, use the /? option to navigate through command options (for instance: schtasks /create /?).
Regards,
Jeff