Do you ever have tasks that you do on a routine basis that never change? Or do you avoid restarting your PC because you hate having to start all of your favorite programs again? Did you know that there is a tool built into Windows to do this kind of stuff for you? It’s name is Task Scheduler.
What Is It
Task scheduler is part of Windows that is available on every version of the operating system since Windows 2000*. If you are running Windows, you already have this program installed. This program allows you to define events or actions to trigger applications/programs and scripts.
How This Is Useful
This is useful as you can define all sorts of different events to automatically run. If any program needs to be kicked off manually, you can schedule it to start automatically. The task editor also lets you define command arguments, or options that can be passed to the program through command line to execute specific tasks. (This will be shown in the example later in the article.) Also, if you learn some basic scripting you open an entire world of possibilities such as automatically moving/renaming or copying files to a new location, opening any application or set of applications with a single task and much more.
How To Set Up a Scheduled Task
To give an example of how to set up a scheduled task, I will create a new task that will open Firefox every time I log in. I will also include an extra argument to start it up navigating to a webpage that is not my defined homepage.
Open the task scheduler by searching for ‘task scheduler’ or in Windows 7 by going to the Start menu->All Programs->Accessories->System Tools and opening ‘Task Scheduler’.
This will open up the application and it should look similar to the image shown below.
From here you can create a new task using the Actions bar on the right, or you can click on ‘Task Scheduler Library’ to view all the currently scheduled tasks. If you click on the Task Scheduler Library folder you will be able to see all the scheduled tasks.
Don’t be alarmed if you already see some scheduled tasks. As you can see in my screenshot, Google uses scheduled tasks to update Chrome which is installed on my PC.
Step 1: Create and Name The Task
Click Create Task from the ‘Actions’ menu on the right side of the window. This will open the Create Task window.
On the General tab, you will need to enter a name to describe the task in the Task Scheduler. I have chosen ‘Start Firefox’. As I want this task to run when I am logged in, I will not change any other settings, so leaving the option to ‘Run only when user is logged on’ is OK. You would only want to change this if you are automating something that you want to run while you or another user is logged off. When this second option is selected, the user account defined in the middle of the window will be used to execute the task and the option to save the password for the user will become available so jobs can run with your account without your intervention.
Step 2: Define Triggers
The next step is to define the triggers that will cause the task to run. Under the triggers tab, we want to click ‘New’ to add a new trigger.
Here we want to change the ‘Begin the task’ section to ‘At log on’ so it will trigger at every log on. Once selected, new options will appear. Here I want to change it to only log in for a specific user, myself. Here you can click ‘Change User’ to pick one or more users to make the rule effective for.
Step 3: Define Actions
After setting triggers you want to define the actions you want the task to perform. Here, we want to click on ‘New’ again to define a new option. In the program/script section I used the dialog box to navigate to firefox.exe and select it. To make this more unique, I looked up what arguments Firefox can accept from the command line from the Mozilla developer documentation. It happens that you can pass a URL to the exe file and it will start a new Firefox session with the chosen URL as the default tab overriding the homepage. So I choose www.nautilusmode.com as it is one of the first sites I want to view every time I use my PC.
Step 4: Define Conditions
The conditions section gives additional controls and options for executing the task. However for this example I will leave them as is as the defaults are fine.
Step 5: Additional Settings
In addition to the conditions you can set there are other settings you can adjust under the Settings tab. The defaults are fine again here as well. However it’s important to note that enabling the ‘Allow task to be run on demand’ will allow you to run the task in task manager without meeting all of the defined trigger criteria. This can be useful to restrict access to help ensure tasks are only run when scheduled.
After clicking OK the task will be completely set up and ready to run. Note: If the user account selected to run the job is password protected, and depending on other settings, you may be prompted to enter the accounts password at this point in time.
Step 6: Test Your Task
So my new task has been created. All I need to do now is test it. I can either reboot, or log off and back in again to trigger the task. However, since I ensured the ‘Allow task to be run on demand’ option under settings was selected, I can also test the tasks actions by clicking Run in the Actions pane of the Task Scheduler window. Don’t have an actions pane? Be sure to click the Task Scheduler Library folder on the left pane to view all your tasks first.
So as you can see in my screenshot below, the task worked successfully!
Although this shows the program executes correctly, you will want to test the triggers with real conditions to ensure they work as well.
This is all there is to creating automated tasks in Windows. If you need additional information regarding any of these settings you can check out Microsoft’s official documentation here: http://technet.microsoft.com/en-us/library/cc721871.aspx
*Information found on Microsoft’s help pages. Here task scheduler is referred to as a new graphical tool available in Windows 2000. Link: http://technet.microsoft.com/en-us/library/bb742547.aspx