Automatically run defined tasks with Task Scheduler

by Fred Langa for Windows Secrets Newsletter

Automatically run defined tasks with Task Scheduler

Task Scheduler is part of Windows’ Administrative Tools, a suite of professional-quality, system-management utilities used to adjust and control many of the operating system’s essential functions and features.

Starting with XP, these tools are either built into Windows or are offered as free add-ons. This guide to using Task Scheduler is the fourth installment in our Windows Administrative Tools series.

Part One of theseries explains what the tools are and how to make them easily available from the Windows Start menu.

Part Two discusses Windows’ Performance Monitor, which reports in real time what’s happening within the OS as programs run — or fail to run!

Part Three describes how to use Windows’ Memory Diagnostic tool to thoroughly test your system’s random-access memory.

I’ll focus on the Windows 7 version of Task Scheduler because that’s the OS most Windows Secrets readers are currently running. Windows XP’s and Vista’s Task Schedulers are similar, so many of the instructions given below also apply to those operating systems. I’ll also include links for Vista- and XP-specific information.

The basics of how Task Scheduler works

To understand how Task Scheduler automatically runs defined tasks, you have to understand triggers. In many cases, a trigger is simply a specific time when Task Scheduler should run a task. You set both the time and the task. Time-based triggers can be once-only (such as “at 8 p.m.”) or repeating (“every Tuesday at 8 p.m. for the next 52 weeks”).

There are, however, other kinds of triggers — for example, system events (such as startup, sign-on, sign-off, or shutdown) or just about any kind of error condition.

You can define any number of tasks. For example, you might have Task Scheduler run a cleanup tool at every system shutdown, automatically launch Windows Network Diagnostics when a connection fails, or start a malware scan late at night when your PC is otherwise idle.

Task Scheduler can do much more than merely launch a program. Obviously, once a program is launched, you want it to actually do something — not just idly sit there.

To specify what the program should do once it’s running, you use special commands — technically called command line inputs or arguments — which are really nothing more than plain-text equivalents of the mouse clicks normally used to control a program.

In short, any program that accepts command-line inputs can be controlled via Task Scheduler.

An app’s online support pages will tell you what command-line inputs are allowed — if any — and how to use them. Here are two examples:

Piriform’s CCleaner clean-up tool accepts a few command-line inputs; they’re listed and explained on the app’s advanced usage page. You can, for instance, use Task Scheduler to automatically run CCleaner and then shut down Windows when CCleaner is done.

Searching the Microsoft site, you’ll find that Windows’ Remote Desktop Connection (RDC) accepts command-line inputs. An MS Help & How-to page lists supported command-line options.

Searching a publisher’s support pages will sometimes reveal that there are two versions of an app — one with a normal graphical user interface and another, nongraphical version specifically intended for command-line use. That stripped-down version will work nicely in Task Scheduler. (I’ll give an example below.)

Rest of the Story Here…

This excerpt appears with permission from Windows Secrets Newsletter.

Stop Responding to Threats.
Prevent Them.

Want to get monthly tips & tricks?

Subscribe to our newsletter to get cybersecurity tips & tricks and stay up to date with the constantly evolving world of cybersecurity.

Related Articles

How to Fight a Malware War

malwar

A tip-filled conversation with Andrew Brandt, director of threat research at Solera Networks, reveals some of the ways hackers sneak malware into PCs.

Read More

Tech Support-call Cons

phonescam

“Hello. This is Microsoft Tech Support. Your PC has notified us that it has an infection.” The call is a scam — an extremely prevalent one. Here’s how it works and what you need to know to stay out of the trap.

Read More