Task Scheduler, a built-in component of Windows operating system, can be used to create a variety of tasks for the computer to follow automatically. You can use it to launch programs or run scripts at a scheduled time without having to depend on third-party tools.
In this post I’ll show how you can use the Task Scheduler to automatically start and close programs at a certain time. And because it is a Windows feature, this should work on all versions of the OS.
Automatically Start Programs at Specific Time
You can directly schedule a single program to start up at a particular time in Task Scheduler. However, if you want to launch multiple programs, a batch file is needed. Here’s how to create and automate one.
1. Open New Document in Notepad, and add this as the first line:
@echo off. Echo off basically turns off command echoing so that you don’t get any messages when running the commands in the batch file.
2. In the next line we will specify the programs to run. Add each program on a separate line:
rem Calculator cd %windir%\system32 start calc.exe rem Media Player cd "C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\" start mpc-hc.exe
rem command is just a comment to identify the program,
CD command changes the directory, and
start is, well it just starts the program.
3. After adding all the programs you want, finish the script by adding
Exit at the end. Complete script should look like this:
Save the file as a batch file with the name
We’re done with our script. Now, to run the script at a specific time it has to be scheduled as a task.
- Open Task Scheduler by entering
taskschd.mscin the Run dialog.
- When Task Scheduler opens, create a new Task, and give it a name.
- In Triggers tab, configure the schedule you want the batch script to run at.
- In Actions tab, browse and select
- If you want, you can configure more settings in “Conditions” and “Settings” tab, but they are not necessary. Finally, click OK to save changes.
That’s it! Your program(s) should now automatically start up at your specified time.
Automatically Close Programs at Specific Time
We have to create another batch script for closing programs at the scheduled time.
Create another New Document in Notepad, and drop in a line like this in it:
TASKKILL /F /IM calc.exe TASKKILL /F /IM mpc-hc.exe
TASKKILL is a built-in utility in Windows used to kill programs and processes.
/F parameter forcefully terminates programs, and
/IM is used to specify the program name.
Save the document with the name
close.bat. Now, just like we did earlier, schedule this batch file as task to run at a time you want. Remember to enable one important setting while doing so – check “Run with highest privileges” in the General tab. This is to ensure programs do exit in Windows.