Written by Barry Dysert (last updated July 30, 2018)
If you have a program that you want to run on a schedule, you'll want to use the Windows Task Scheduler. (Understanding the Scheduler is covered under a separate tip.) To launch the Task Scheduler,on Windos 7 go to Start | All Programs | Accessories | System Tools | Task Scheduler. Windows displays the Task Scheduler dialog box. On Windows 10 click the start button in the bottom left corner then type "Task Scheduler" and press enter. (See Figure 1.)
Figure 1. The Task Scheduler dialog box.
Let's say that you have a program named CopyFiles.exe that you'd like to run automatically every day at 2:00 a.m. At the right side of the Task Scheduler dialog box, under the Actions list, you can start by clicking the Create Basic Task option. This starts the Create Basic Task Wizard. (See Figure 2.)
Figure 2. The Create Basic Task Wizard dialog box.
At the left side of the wizard dialog box you can see that there are four steps to be finished. The first step is to provide a name and description for this task. (The name is mandatory; the description is optional.) Since we want this task to run a program called CopyFiles.exe, let's name the task "Copy files." For its description we can put something like "Copy files from my Working folder to my Backup folder." After entering the information, click the Next button and you'll see the second step of the wizard. (See Figure 3.)
Figure 3. Defining the trigger for the task.
In this second step you need to define the trigger for your task, initially by specifying how often the task will run. Windows allows you to start your task when certain events occur or according to a schedule. Since we want our task to run every day you should select the "Daily" option and click the Next button to proceed to the next step. (See Figure 4.)
Figure 4. Specifying details for a daily task.
In this step you further refine the trigger by specifying when you want the task to first start and the time each day when it should run. This task is going to start at 2:00 a.m. every day, so that needs to be entered. You can then click the Next button to advance to the next step. (See Figure 5.)
Figure 5. Defining the action for the task.
Here is where you select what action is to be performed when the task starts. We can display a pop-up message on the desktop, send an e-mail, or start a program. We want to start a program, so we select that option and click the Next button to get to the next step. (See Figure 6.)
Figure 6. Specifying details for the action.
Since you indicated you wanted to start a program, you now have to choose which program to start. You specify the name of the program you want to run ("CopyFiles.exe"). If the program required command-line arguments to be passed to it, you could fill in the Add Arguments field. Similarly, if the program needed to be started in a particular folder, you could specify that in the Start In field. Since this example program requires neither, you can click the Next button to get to finish up the task definition. (See Figure 7.)
Figure 7. The Create Basic Task Wizard summary.
The final step of the wizard presents a summary of the information that you specified for the task. If you review the information and realize you made a mistake, you can click the Back button as needed to go back and change things. Once you're satisfied that the task has been correctly specified, click the Finish button and the task is created. It will run according to the schedule you specified.
This tip (12442) applies to Windows 7, 8, and 10.
If you want to have a program run at a certain time or when a specific system event occurs, you'll want to understand the ...Discover More
It's easy to have a program run when Windows starts. In fact, by using the Task Scheduler, you can have all sorts of ...Discover More
In another tip you learned a bit about the Windows Task Scheduler. There may be times, however, when you want to perform ...Discover More
Once Task Scheduler starts a program, if a user manually stops the program that is running, will the task see that the program is no longer running?
Example: A .bat file is being run that is an ongoing process to read from an email inbox and do something with the email if certain parameters are met. The .bat file opens a command prompt. If a user on the machine in question closes the command prompt, the .bat file will no longer be running.
If I've configured the task to re-run once per day (and check if it's not running every 15 minutes and re-run if not) - once the command prompt is closed, will the task see that the executed program has stopped and re-run or will the task still be seen as successfully run?
I was very excited to see this but was disappointed when I saw "send an email" and "display a message" deprecated. It seems like a useful feature no longer exists. Puzzled.