One of the most powerful new features in Windows 7 (and Vista), Task Scheduler, is hidden deep inside the operating system and rarely used. It allows PC users to automate a number of actions, such as launching a cleaning tool on a weekly basis, solving a problem the moment it occurs, or simply displaying reminder messages. The potential for making your PC more intelligent with Task Scheduler is endless.
Starting with a couple of examples, we’ll show you how to use this great feature to automate Windows exactly the way you want. This is a two-part series—in this post, the TuneUp Blog team will cover how to launch a process at a specific time and end it again after awhile. In a follow-up post, we’ll show you how to detect and correct specific Windows errors with Task Scheduler and Event Viewer.
Using Task Scheduler
- Perform an action at a specific time.
- Perform an action at a specific moment (also known as a “trigger”). For example, this might be when users log on.
- Perform every action only under a certain condition. For example, this might be when users’ PCs are idle or when a network connection is available.
Launching Task Scheduler
While Task Scheduler itself is a tough nut to crack (don’t worry—after reading this post, you’ll be able to understand it), finding it is quite easy. Click on the Start orb, type in “Task Scheduler”, and hit Return.
For a list of all of the currently active third-party software tasks, go to “Task Scheduler Library”. To create one yourself, hit “Create Task” on the right-hand side.
Let’s find out how to set up tasks by going through the following scenarios.
Use Task Scheduler to launch a program or a simple batch file.
Do you have a program or a batch file that you launch on a regular basis at a specific time? Automate this process! As part of my daily routine, I usually start TeamViewer 5 on my office desktop machine before I go out to lunch. Why? Well, I’ve got a mobile TeamViewer app on my phone, so in case anything urgent comes up while I’m away from my desk, I can quickly access my PC, files and applications. However, I don’t like TeamViewer to run 24/7. That’s why, I set up TeamViewer to start at 12 p.m. and quit at 2 p.m. every day. Although I rarely take two hours off, it’s a nice buffer in case I’m running a bit late. Here are the steps I took to set this up:
- I launched Task Scheduler as described above. Then, I went to “Create Task” and entered the name of the task (“Launch TeamViewer”). Since I log off whenever I go to lunch, I also check if “Run whether user is logged on or not” is enabled.
- Again, I’d like Windows to launch the program at 12 p.m. To activate that function, I went to “Triggers” and clicked on “New”. I then hit “Daily” and selected the start time to be 12:00:00.Now if you’re asking yourself, how do I make a task automatically end after a certain amount of time? No problem—just keep on reading!
- Next, I switched over to the “Actions” tab and hit “New”. I left the “Start a program” setting intact because that’s exactly what I wanted. I hit “Browse” and manually selected TeamViewer via the Windows-Explorer.
- Done? Not quite yet! I then hit “OK” and created a new task. I named this one “End TeamViewer”. In the “Triggers” section, I created a new trigger that starts at 2:00 p.m. every day (see step 2), and moved over to the “Actions” tab to make Windows automatically kill the TeamViewer program at 2:00 p.m. sharp. I clicked on “New” and entered “taskkill /f /im teamviewer.exe”.
What did I just enter here?
- I used the “taskkill” command, which comes with Windows Vista and 7 and lets you end a running program.
- I then used the command line “/f” to force the killing of the task.
- Finally, I used “/im” to specify that I want to end a task by name—in this example, “TeamViewer.exe”.
How do I know which program to kill (or to execute)?
Well, I right-clicked on the TeamViewer shortcut, hit “Open file location” and looked up both the path in Windows Explorer as well as the name of the file.
To make sure that TeamViewer.exe is also the task I wanted Windows to kill (that might not always be the same!), I opened up Task Manager by right-clicking on the taskbar and selecting “Start Task Manager”. I quickly scrolled through the list of running “Processes” and found “TeamViewer.exe” running.
Note: I’m on a 64-bit system. That’s why Windows marks all non-64-bit processes with a *32—just ignore that!
That’ it—I now have two new tasks in my library: one for launching TeamViewer.exe at 12 p.m. every day and the other for killing it at 2 p.m. every day. Now imagine the possibilities of launching programs at a specific time and automatically ending them—you could do that to clean up a specific folder, launch a browser to automatically download a file or launch a file-sharing application of your choice.
Find out more about Task Scheduler in Part 2 of our Windows Automation series…
5 Responses to “Fully Automate Your PC with Task Scheduler (Part 1 of 2)”
- Geek Squeaks’ of the Week (#87) « What's On My PC
- Fully Automate Your PC with Task Scheduler (Part 2 of 2) » TuneUp Blog about Windows