Scheduled tasks run periodically in the background. They're useful for tasks that you want your computer to do routinely, without you having to manually intervene.
Go to the Start menu -> All Programs -> Accessories -> System Tools -> Scheduled Tasks.
If you double-click "Add Scheduled Task", the Scheduled Task Wizard starts.
If you click "Next", you'll see a window which gives a list of applications that you might want to schedule.
If the one that you want isn't there, you can use the "Browse..." button to locate it, but you do need to know where the executable for the program you want is located. If you don't know how to do this, see the section on How to Locate an Executable below. In this example, we're going to set up a scheduled task to cleanup the disk, which is in the list.
next step is to give a name to the scheduled task, and specify the frequency with which it should run.
After this, we can specify the time and days of the week (because in the previous step we specified that we want to run this on a weekly basis).
Following this, we need to specify a username and password for one of the users on the computer. The task will then run as if it were started by that person.
After this, the setup of the task is complete.
If we go back to the main Scheduled Tasks window, we'll see that the new task is listed.
In this window, I can select any scheduled task and double-click to open its properties. I can also select a task and then click "Delete this item" under the "Folder Tasks" list which will appear on the left-hand side of the window.
Within the task properties, the "Settings" tab allows you to control some advanced options.
There are options here which allow you to make sure that your scheduled tasks don't interfere with normal use of your computer. While I might schedule a task to run at, say, midnight, because I don't usually use my computer then, one day I might do so, and wouldn't want disk cleanup or defragmentation to slow everything down.
So, as you can see in the picture above, I've specified that the task should stop if it runs for more than 6 hours, that it should only run if the computer has been idle for at least 15 minutes before the start time, that if that is not the case it should continue to retry for an hour (in case the computer does become idle during that time), that if the task starts and then the computer ceases to be idle the task should stop, and that the task shouldn't start if the computer is running on batteries (for a laptop, obviously).
When you access an application via a menu or a shortcut, you don't know the actual location of the executable file associated with it. The easiest way to find this is to right click on the menu item or shortcut, and select "Properties" from the pop-up menu.
In this case, the properties window tells me that the executable for Disk Cleanup is located at: %SystemRoot%\system32\cleanmgr.exe.
This looks a little strange, but the "%SystemRoot%" is just a reference to a variable which Windows uses to specify the location of the Windows system files. In most cases, this is C:\Windows, so the full path would be C:\Windows\system32\cleanmgr.exe.
If you want to check what this and other variables are set to, you can do so in a Command Prompt window (accessible via Start menu -> All Programs -> Accessories -> Command Prompt). If you just type "set", it will display all environment variables with their current values.
When run from the command line rather than through the normal graphical interface (which is what happens with scheduled tasks), many executables have additional arguments (also referred to as parameters, options or switches) which can be specified to control how they operate. In order to make sure that your scheduled tasks will run correctly and do what you intend, you need to understand these parameters, but this can be tricky to find out.
Some commands support a "-?" argument which lists the valid parameters. An example is the defrag executable. If I start a Command Prompt from the Start menu -> All Programs -> Accessories -> Command Prompt, and then type "defrag -?", I get a list of the valid arguments that I can add.
What this tells me is that I need to specify the drive, and can add an option like "-f" to force defragmentation even if space is low. To do this, I need to open the settings for the task (explained above) and append them to the command in the "Run:" field in the "Task" tab.
Disk Cleanup is a little more complicated, in that the executable isn't as friendly, so it doesn't list the options for you. Also, you need to configure the options that you want to use for the scheduled task in advance.
You need to open a Command Prompt (as above), and type "cleanmgr /sageset: 1" (or any other number). A window opens in which you can specify the types of files you want Disk Cleanup to remove.
Check the boxes for the types of files you want to cleanup, and click "OK". Now, you've configured a set of options for Disk Cleanup, and the next step is to tell the scheduled task to use these options. To do this, you need to add the parameter "/sagerun: 1" (or whichever other number you chose when configuring the settings) to the command. The method for doing this is the same as for the defragmentation example given above.
The arguments for a particular command should be specified in the documentation associated with it. For Microsoft applications (such as cleanmgr), a good reference for information like this is the Microsoft Help and Support website.
<-- Previous Page Use System Restore |
Next Page --> Frequently Asked Questions |