How to Schedule Programs to Run Automatically

It's often very handy to be able to schedule tasks to run unattended. The classic example is backup. I backup my key data each night at 2.00 a.m. and thankfully I don't have to be there to make it happen. Instead it takes place automatically using the task scheduler built into the backup program.

However, not all programs have an inbuilt task scheduler. In these cases it's still possible to run the program using a scheduling program. In this article we will look at two: Task Scheduler  that comes free with all Windows versions from Windows 98 onwards and a rather more sophisticated freeware product called System Scheduler.

Windows Task Scheduler

Windows inbuilt scheduler is perfect for scheduling programs that don't require any keyboard inputs to run.

Let's explore the use of Windows Task Scheduler by setting up an automated daily task to clean all the junk files off your hard drive. I'll use Windows XP in this example but the technique I'll describe works for Vista and Windows 7 as well though the interface for Windows Task Scheduler is a little different in each case.

The program we will use to do the cleaning is the excellent free utility CCleaner. If you don't have a copy, go grab it now from here: http://www.filehippo.com/download_ccleaner/

After downloading, install the program on your PC. During the installation make sure you un-check the option to install the Yahoo Toolbar, unless, that is, you really want it. After installing CCleaner start the program and check the default cleaning options to make sure these are what you want. For example, if you want to retain your browser history and auto-complete make sure those boxes are unchecked. Once you are happy with the options, shut down CCleaner.

Now start up the Windows Scheduler by clicking Start / Control Panel / Scheduled Tasks / Add Scheduled Task.  Click on Add a Task and this will start the Scheduled Task Wizard. Click <Next> and this will bring up a list of programs. Select CCleaner then <Next>.

Then select Daily and <Next>. Then whatever time you want the program to automatically run and <Next>. After that, enter your username and passwords followed by <Next>. Don't click <Finish> just yet.

Now we need to use a little trick. If you stop at this point CCleaner will run automatically at the prescribed time but won't actually do any cleaning. It will be just sitting there waiting for you to press some buttons.

To get around this you need to tell CCleaner to run without any user intervention. Thankfully the folks at CCleaner have provided a special command line option to do this.

To add the command line option, check the "Open advanced properties" box in the Task Scheduler Wizard and then <Finish>. In the "Run" box you should have something that looks like this:

"C:\Program Files\CCleaner\ccleaner.exe"

Now click at the end of this line just after the .exe, leave a space and then type in /AUTO so the complete line now looks like this:

"C:\Program Files\CCleaner\ccleaner.exe" /AUTO

The /AUTO tells CCleaner to run automatically once started and exit automatically when finished which is exactly what you want.

Well that's it! You've now created a scheduled job that will clean your hard drive of unwanted files every night.

If you want to create other scheduled jobs such as backup or defragging your hard drive you can do so in the same way.

Unfortunately, not all programs have command line options like CCleaner that allow automatic running without user input. For these programs to run automatically you need a program that can automate the entry of keystrokes.

System Scheduler

For more complex task scheduling my top choice is System Scheduler. It does a similar job to Windows Scheduler but additionally it allows you to enter any key-presses required  by a program in order to run.  You can do this by entering into System Scheduler a line containing the keystrokes you want to execute when the program runs.

Lets look at a practical example using DiskKeeper Lite. When you run this program you need to click a few buttons in order to start a defrag job. Usually you would use your mouse to do this clicking but you can also use keystrokes to achieve the same thing ike this:

  • Close the nag screen. This can be done from the keyboard in DiskKeeper by pressing Alt F4
     
  • Select the menu item "Actions."  This can be done from the keyboard by pressing Alt A
     
  • Select from the Actions menu the item "Defragment." This can be done from the keyboard by pressing the "D" key

In System Scheduler you would do this by entering the string "%{F4}%{A}D" into the "Sendkeys" field within the System Scheduler job setup panel.  Note that in System Scheduler plain keystrokes such  as "D" are entered as you would normally type them but special keystrokes such as Alt  F4 have to be entered using a code like %{F4}. Full details of these special key codes can be found in the System Scheduler help file.

The developer offers a free and a Pro version of System Scheduler. The latter has some useful additional features such as the ability to reboot and run as a service but the free will do for most folks. Furthermore, the free version covers both home and business use.

Gizmo

Share this
4.236365
Average: 4.2 (55 votes)
Your rating: None

Comments

by beau on 23. February 2013 - 15:24  (105698)

How can Task Scheduler be forced to display a message on top of all other open windows?
I can't find anything like "On top" under Properties.
I'm running Win7

by v.laurie on 20. September 2012 - 20:20  (99525)

An article about Task Scheduler in Windows 7 is at http://www.techsupportalert.com/content/how-schedule-programs-run-automa.... In windows 7, there are many more options for running programs, including a provision for providing input arguments for a program.

by darren (not verified) on 8. July 2011 - 5:24  (75000)

Downloaded SS tonight (No problem from avast) Although after install comodo gave this warning.

.Heur.Suspicious@1

C:\Program Files (x86)\SystemScheduler\Scheduler.exe

Virus total 1/42 false positive.

by MidnightCowboy on 8. July 2011 - 7:06  (75010)

Thanks for the update. The very nature of the program is likely to cause some security programs to view it as suspicious. Looks like Avast! have fixed their FP.

by darren (not verified) on 5. July 2011 - 14:17  (74792)

Avast blocks download page for system starter finds trojan

by darren (not verified) on 5. July 2011 - 14:18  (74793)

sorry system scheduler is blocked by avast

by Anupam on 5. July 2011 - 15:37  (74801)

You are right. Thanks for this information.

by MidnightCowboy on 5. July 2011 - 17:12  (74809)

VirusTotal URL scan 1/16 (Websense) and URL Void clean. It's a false positive.

by Anupam on 5. July 2011 - 19:28  (74817)

Maybe the download page for System Scheduler has been compromised somehow? I trust Avast alert.

by Ardwych (not verified) on 8. February 2011 - 18:46  (66047)

BTW, this looks like an old Win Task Scheduler. Vista and Win7 look quite different. Is it time for an update? I ask because I'm having great trouble getting syntax and settings right, especially since I run normally as a standard user, and some jobs require admin rights - but they don't necessarily run. It should be easy, but..

by Anonymous on 23. March 2010 - 6:00  (46035)

thnx a lot really helped.... :)

by Anonymous on 9. February 2010 - 3:18  (43137)

I have always had both my (Vista) computers restart every morning with a freebie called Switch Off. It has done a great job even though it was last updated in 2002 (version 2.3.0.1). In the CCleaner settings I have "Run CCleaner when the computer starts" checked. Then CCleaner does its cleaning everyday, automatically.

By the way, both my computers run as if they were brand new out of the box. Of course, I use other programs also to keep them that way.

PS I just noticed at Download.com that Switch Off was updated on 1-15-2010 (version 3.1.0.380).

by zachary (not verified) on 8. August 2010 - 10:34  (55623)

In your e-mail on www.techsupportalert.com,you said "By the way, both my computers run as if they were brand new out of the box. Of course, I use other programs also to keep them that way.",what other programs do you use to keep your pc like new?
thanks,Mark

by Frank Tracy (not verified) on 13. November 2010 - 8:43  (61135)

Programs include Glary Utilities, WinPatrol, CleanMem, several Defrag utilities, Secunia PSI, Vista Services Optimizer, TweakUAC, and Ultimate Windows Tweaker. Once a week I also have my PC Automatically fix file system errors, and delay some startup programs. In addition I've implemented several tips I've found in books about Vista.

by Anonymous on 10. February 2010 - 4:51  (43231)

The cnet editor gave it a 5star rating, as I would, though the 2 customer reviewers didn't quite seem to know how to use it. I know that it took me several tries to get it configured correctly.

and the official website link:

http://www.airytec.com/en/default.aspx

Moderator's Comment: Download link removed. Please do not link directly to downloads. :)

by Anonymous on 15. February 2010 - 2:24  (43643)

I forgot to mention:

To get Switch Off to run correctly I had to do several things: 1. Check "Run whether users are logged on or not." 2. Check "Run each time windows starts." 3. Make sure that in a separate startup program that Switch Off is enabled. 4. In one of those startup programs, set Switch Off to have a delayed start, otherwise it would not start automatically each day. Once I got these settings figured out, the program works great. For me, Switch Off is a must have program!

This is from my comments I left at download.com

Frank

PS I used the feature in Glary Utilities for #3 and #4 but I guess you could use programs such as Startup Delayer or WinPatrol

by Anonymous on 15. February 2010 - 5:41  (43650)

Lastly, run Switch Off as administrator if need be. This is only needed in the newer versions as the early 2.3 version runs just fine without administrator privileges and without the delayed startup. That early version is still available at the author's website.

by Anonymous on 1. February 2010 - 14:08  (42549)

CClean only cleans files for the currently logged in user, right?. So, runas 'gizmo' will only clear temp files for 'gizmo' in this example? I want to clear temp files for all users.

by wesman on 4. September 2010 - 19:22  (57279)

I have had sucess with a good old batch file.

by Anonymous on 19. January 2010 - 13:59  (41529)

My 2¢: You shuld turn off your PC if you won't be using it for a substantial amount of time. This is for two reasons: Energy savings and Security. The energy savings (although small) will add up over time and there is no more secure PC than one that is not on.

by jiffy54 (not verified) on 26. August 2010 - 8:51  (56751)

yes these schedulers are wonderful for epople who elave their pcs running 24/7

But far more useful would be something that can run during the nigth when your pc is switched off.

By that i mean something that will partially boot up a pc at a specific time during the night, run a few scheduled tasks then switch off again. By partially i mean something like a safe mode with no user interface (keyboard/mouse/printer) activated but creating a run log that can be viewed on real boot next morning. All to run on battery power for laptops if necessary so the thing does not even need connecting to the mains power supply.

Ambitious? Certainly. Useful - YES Possibly? I dont see why not!

Go tell me something like that already exists (PLEASE!)

by Ardwych (not verified) on 8. February 2011 - 18:18  (66041)

SLR claims to be able to do that:
http://members.iinet.net.au/~prefect/slr_main.html
As does WakeupOnStandBy
http://www.dennisbabkin.com/php/download.php?what=WOSB

See how they go.

by Bob on 18. January 2010 - 21:08  (41470)

How well explained is that! The Gizmo Richards hallmark style.

One query:
- I've always believed it's better, as a general rule, to shut ones computer down at night so that the motherboard etc. can get some shut eye and discharge the static electricity accumulated at work. But perhaps I'm wrong. And maybe one could just schedule ones computer to shut down anyway once it's finished its night shift?

by ianjrichards (not verified) on 19. January 2010 - 0:29  (41486)

This is a moot point Bob. Some techies advise turning your PCs off, others advise leaving them running. Personally I leave my PCs running all the time and must say I have had very few hardware problems over the years.

by Bob on 19. January 2010 - 7:22  (41504)

hmmm... that's interesting - thanks.

by Anonymous on 19. January 2010 - 15:40  (41538)

Best to leave a computer running because electronic items tend to blow out at startup. When an electric item is turned on, there is an initial surge of heat which goes through the parts.

This is easiest to see with light bulbs, it's the same reason why light bulbs normally go out when a bulb is cold and the switch is flipped on rather than just burning out while running.

by Bob on 20. January 2010 - 3:50  (41578)

yes, I've just been wondering whether anyone happens to know of any indicative, scientifically conducted statistical studies on the subject?

(But I wouldn't want to get off topic... let's stick to the schedule!)

by Anonymous on 22. January 2010 - 0:59  (41722)

In the days of huge mainframes, it was quite a chore to get the beasts up and running. Most were kept running to save that time. PCs are well protected from turn-on surges so keeping them running is not a good thing as overheated parts can cause a fire if not caught in time. I wouldn't want to be away from home with my computer self-distructing.

by Anonymous on 18. January 2010 - 17:23  (41449)

You should check out Autoit, a freeware auto run programme which allows recording of commands and mouse clicks, allows most window manipulation commands, and creates editable scripts.

by ianjrichards (not verified) on 19. January 2010 - 0:42  (41489)

That's a fair comment but AutoIt is a full scripting language and overkill for most simple scheduling tasks. Great product though.

Gizmo's Freeware is Recruiting!

Gizmos Needs YouShare your knowledge of free software with millions of Gizmo's readers by joining our editing team.  Details here.