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 the Windows Task Scheduler that comes free with all Windows versions from Windows 98 onwards. In fact, many programs that have automatic scheduling make use of the Windows Task Scheduler to do the real work.

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.

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. 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. There are many such programs available, including some excellent free programs such as this one.

4
Average: 4 (1 vote)
Your rating: None

Shouldn't this:
"C:\Program Files\CCleaner\ccleaner.exe /AUTO"
be:
"C:\Program Files\CCleaner\ccleaner.exe" /AUTO

On my state-of-the-art win98 machine it is, otherwise it gets changed to:
"C:\Program Files\CCleaner\ccleaner.exe \AUTO". You can try it by executing the task. If you see an icon appearing in your taskbar for a few seconds, all is well.

Thanks for pointing this out.

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

is the correct one.

Now updated in the review.

ok hier is my question.great post
i was wondering i run program autounpacked in task scheduler in vista but i dont know how to start it.someone told me comand line /run
but i dont know where to put it.please help

The last sentence in this article includes a link under the words 'this one' which it says is a link to an article about programs which offer automatic keystroke entry, but it actually links back to diskeeper lite.

Thanks, it works excellent in Vista too.

In Vista, you can access the Task Scheduler from Control Panel / Administrative Tools / Task Scheduler. Or it is usually located under Accessories / System Tools in the start menu.

Then select Create Task. First you create a trigger/scheduler for the task. The trigger gives you many different options, such as to run it daily at any time you want. Secondly create an action for the specific program you want to run (you add the command line /AUTO argument in this step). It is very similar to Gizmo's directions.

There is also an option to trigger the Ccleaner periodically once it begins running. For example, you could follow these steps:

(1) Go to Task Scheduler / Create Task.
(2) On the General tab: select "Run whether user is logged on..." and check "do not store password." Also check "Run with highest privileges".
(3) On the Triggers tab: Begin the task "at startup", Delay Task for 30 seconds (to prevent it failing at startup, at least for me), Repeat task every hour (or so) and for a given period of time or indefinitely, Check Activate, Check Enabled. Click "ok"
(4) Set Action as usual.

If you run CleanMem, then just mimic the settings for it. I analyzed before and after running it and it successfully cleaned even though it did not display an icon while it was cleaning.

I was not aware of this, does Ccleaner run minimized ?

Indeed, I have found some other usefull command line arguments here:

http://www.ccleanerbeginnersguide.com/scr/commandline.htm

cant do it. It tells me i dont have permission to run the operation. I dont have any password to login.

Try checking the box "run only if logged in"

Nice one, this will definetly help me.

Great article, keep up the good work.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <b> <address> <blockquote> <br> <caption> <center> <code> <dd> <del> <div> <dl> <dt> <em> <font> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <li> <ol> <p> <pre> <span> <strong> <sub> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <u> <ul> <tr>
  • Lines and paragraphs break automatically.
  • [node:123] - insert full text (themed by theme('node'))
    [node:123 body] - insert node's body
    [node:123 teaser] - insert node's teaser
    [node:123 link] - insert link to node
    [node:123 collapsed] - insert collapsed node's body
  • You may use [view:viewname] tags to display listings of nodes.

More information about formatting options