Site hosted by Angelfire.com: Build your free website today!
Chapter 2: Running Programs

PreviousChapterContentsGlossaryNext

Running Programs on a Schedule Using Scheduled Tasks

Scheduled Tasks is the program Windows uses to check the files and folders on your hard disk automatically. You can also use the Scheduled Tasks program to run almost any program at a specified time on a regular basis. When you schedule a task, you must specify the following information:

When Scheduled Tasks is running, its icon appears in the system tray at the right end of the taskbar.

Scheduling a Program

To tell Scheduled Tasks to run a program on a regular schedule, follow these steps:

  1. Look at the Scheduled Tasks window by choosing Start | All Programs | Accessories | System Tools | Scheduled Tasks; or choose Start | Control Panel, click Performance And Maintenance, and click Scheduled Tasks. You see the Scheduled Tasks window, shown in Figure 2-7.
[figure]
Figure 2-7: The Scheduled Tasks window
  1. Run the Add Scheduled Task item that appears in the Name column of the Scheduled Tasks window. (If it's underlined, click it once. Otherwise, double-click it.)
  2. Windows runs the Scheduled Task Wizard, which takes you through the steps required to schedule tasks to run automatically. Follow the prompts on the screen, clicking Next to move to the next step.
  3. When the Scheduled Task Wizard displays all the information you have specified about the program's schedule, including the name of the program and when you want it to run, click the Finish button. The program appears on a new line in the Scheduled Tasks window.

Be sure to leave your computer turned on all the time, so when the scheduled time arrives, Windows runs your program. If your computer is off (or Scheduled Tasks isn't running) when the time comes, the program doesn't run.

note When you schedule a task, Windows creates a file with the extension .job in the C:\Windows\Tasks folder (assuming that Windows XP is installed on your C: drive).

Canceling a Scheduled Program

If you decide you no longer want Windows to run the program automatically, open the Scheduled Tasks window, right-click the line for the program, and choose Delete from the menu that appears. When Windows asks you to confirm that you want to delete the file for this job, click Yes.

To cancel running all scheduled programs, choose Advanced | Stop Using Task Scheduler from the menu bar in the Scheduled Tasks window. No scheduled programs will be run until you choose the command Advanced | Start Using Task Scheduler. You can pause the scheduler program by choosing Advanced | Pause Task Scheduler to skip running scheduled programs temporarily and choose Advanced | Continue Task Scheduler to resume. Pausing Scheduled Tasks is a good idea while you are installing new software, for example, so installation isn't interrupted.

Configuring a Scheduled Program

You can configure other settings for a scheduled task. Click or double-click the line for the task in the Scheduled Tasks window (or select the line and click the Properties button on the toolbar, or right-click the program name and choose Properties from the menu that appears). You see a dialog box with all the settings for the scheduled program (see Figure 2-8). Table 2-1 lists all the settings you can specify when you schedule a program to run.
[figure]
Figure 2-8: Settings for a scheduled program

Tab in Dialog Box Setting Description
Task Run Specifies the pathname (and optional parameters) to run the program. If the pathname includes spaces, enclose the entire pathname in double quotes. Click Browse to find a program.
Task Start in Specifies the default folder for the program files (some programs require files other than the program file, and this setting tells the program where to look for them).
Task Comments Provides space for you to type comments (ignored by Windows).
Task Run as Specifies the user account to use when running the program. Click Set Password to type the password for that user account.
Task Enabled Specifies that the task is scheduled. To suspend scheduling the task, clear this check box.
Schedule Schedule Task Specifies the frequency the task runs: daily, weekly, monthly, once, at system startup, at logon, or when idle. The rest of the settings on the Schedule tab of the dialog box depend on which frequency you choose.
Schedule Start time For daily, weekly, monthly, or one-time tasks, specifies the time Windows starts the program.
Schedule Advanced Displays the Advanced Schedule Options dialog box, in which you can specify an end date or number of repetitions.
Schedule Show multiple schedules When this check box is selected, a box appears at the top of the Schedule tab from which you can pick from a list of the schedules you have defined.
Settings Delete the task if it is not scheduled to run again Specifies that Windows delete the item from the Scheduled Tasks list after running it (useful for programs you have scheduled to run only once).
Settings Stop the task if it runs for xx hours xx minutes Specifies the maximum number of hours and minutes the scheduled program can run. If the program is still running after the specified amount of time, Windows stops the program.
Settings Only start the task if computer has been idle for at least xx minutes Specifies that Windows should start the task only after the specified amount of time with no keyboard or mouse use.
Settings If the computer has not been idle that long, retry for up to xx minutes If the computer has not been idle for the amount of time specified in the preceding setting when Windows tries to start the program, specifies the number of minutes during which Windows should try to run the program.
Settings Stop the task if computer ceases to be idle Specifies that Windows stop the program if you begin to use the computer.
Settings Don't start the task if computer is running on batteries Specifies that Windows not start the task if the computer is running on batteries. Some programs, especially disk-housekeeping programs, perform lots of disk access, which can run down your computer's batteries.
Settings Stop the task if battery mode begins Specifies that Windows stop the program if your computer switches from external power to batteries.
Settings Wake the computer to run this task Wakes the computer when the task is schedule to run, even if it is suspended or in sleep mode.
Table 1: Settings for a Scheduled Task

Other Scheduling Options

You can ask Scheduled Tasks to let you know how its scheduled programs are doing. If you want to be notified when Scheduled Tasks is unable to run a scheduled program, choose Advanced from the Scheduled Tasks window's menu bar and make sure a check mark appears to the left of the Notify Me Of Missed Tasks option (if no check mark appears, choose the option from the menu).

You can look at a log file of the results of scheduled programs by choosing Advanced | View Log from the Scheduled Tasks menu bar. Windows displays the log file, which is stored in text format in C:\Windows\SchedLgU.txt, using Notepad. Log entries consist of several lines of text, as shown here:

"Activation reminder.job" (oobebaln.exe)
Finished 7/3/2002 1:39:35 PM
Result: The task completed with an exit code of (0).

The first line describes the program, and the subsequent lines report on the outcome of running the program.

PreviousChapterContentsGlossaryNext