Pinterest Stumbleupon Whatsapp
Ads by Google

PCs are marvelous tools, aren’t they? They can do so much for us, but they’re hardly the user-friendly home computers promised in science-fiction, which can follow any voice command and perform self-maintenance. It would be nice, at least, if your PC could at least do some things on its own. How about automatic weekly disk defragmentation or disk cleanup?

Here’s how to use Windows’ Task Scheduler to run desired programs automatically at preset time.

An overview of Task Scheduler is in order. Open it from Start Menu > Programs > Accessories > System Tools > Scheduled Tasks. Double-click “Add Scheduled Task” to open the Wizard.

run programs automatically

windows task scheduler

Your first step is to select the program to be run on a schedule. For this example, we’ll schedule one of MakeUseOf’s favorite Windows programs, CCleaner, to perform automatic system cleanup. Download it here.

Ads by Google

how to run programs automatically

image

You’ll next choose the day and time when to run the program. For a disk-cleanup tool such as this, running daily or weekly should be just fine. I’m scheduling CCleaner to run at 6:17 PM every day.

image

image

Next, name and provide the password for the Windows user account which will run the program. At the next step, select the checkbox to open the task’s advanced properties.

image

Now, looking at how this task is set up, not much is going to happen on schedule, except that CCleaner opens. To get CCleaner to do its thing, we’ll need to add some command-line arguments, or “switches”, to the Run line. Depending on which program you’re wishing to automate, this is where things start to get different. To find out what switches exist, if any, you may check the program’s documentation and help files, or just Google it.

image

For CCleaner, adding “/AUTO” to the Run line will have the program perform a disk cleanup silently and in the background, then close when done. Let’s go back to the task properties, where I’ve added the switch to the Run command.

image

After hitting OK, CCleaner will run on your specified schedule.

There are other solutions to run programs automatically on a specified schedule or in response to a system event. What are your own favorites? Give us some ideas in the comments.

  1. Todd
    January 24, 2010 at 11:07 am

    Ivan, I know of a couple workarounds. If you check the "Run only if logged in" box in the task scheduler, it will run w/o a password, but like it says, only if you're logged in.

    The second is a registry edit. Go to http://www.kellys-korner-xp.com/xp_tweaks.htm. Scroll down to line 67: Run Scheduled Tasks w/o PW Home. Click on Home, the instructions to use VBS Files at top of web page. This is says it's only for XP, but it might work on Vista/win7. I STRONGLY recommend that you backup your registry first.

    There is a third option as well. Create a login password for your account, then click Start, Run and type "control passwords2" w/o the quotes, then highlight your user name then uncheck the "users must enter name....". Now you won't have to put in a password to login, it will boot right to the desktop just like it did before, but you'll have one to put in the Task Manager. :-)

  2. Ivan
    December 22, 2009 at 2:14 pm

    i just tried it but i dont have a password for my user and it says that you need a password, so the program didnt run, Anyway to make it work without a pass?

  3. Nick
    April 29, 2009 at 8:02 am

    Well I tried it in Vista, I don't know if its the same, but if you could write one for Vista that would be awesome. But I hope it's the same and I hope it will work!

    I only going to run CCleaner once a week. :P

    • Juscelino M. Acevedo
      April 29, 2009 at 11:28 am

      I may be wrong, but unless the writer is using a theme in XP, those screen shots look very much like Vista windows.

      • Nick
        April 29, 2009 at 12:16 pm

        You are wrong :P It is Most likely Windows XP Pro. Windows Vista has a completely different interface. Plus windows Vista Task Scheduler is 100 percent different, so that gives it away also. Plus there are no Vista Icons, those are all XP Icons.

        • Juscelino M. Acevedo
          April 29, 2009 at 1:26 pm

          Don't worry, I don't mind being wrong once in a while. I have not being around a Vista machine in about a month, so I guess it's easy to forget what things look like... :-)

        • Nick
          April 29, 2009 at 3:05 pm

          Don't worry either, I understand, one of my good friends had never used Vista before and right now is just currently starting to use Vista and when switches to Vista I will be switching to Windows 7, hahaha. I can't go back to using XP anymore, just can't It is impossible.

  4. Juscelino M. Acevedo
    April 28, 2009 at 10:02 pm

    As familiar as I am with Task Scheduler and CCleaner, I never thought about using them together. This is an excellent tip which gives me other ideas due to the fact that I am a clean freak when it comes to my computer(s).

    Keep up the good work.

  5. guru
    April 28, 2009 at 6:25 am

    Remember about space in command line

  6. Alessandro
    April 27, 2009 at 3:16 am

    hello!
    with regard to defrag?
    every how many days should be done?
    the command does not work with defragmentation: C: \ Program Files \ Defraggler \ Defraggler.exe / AUTO

    • Aibek
      April 28, 2009 at 6:33 am

      I'd recommend doing it about once a month.

  7. SleepingPanda
    April 27, 2009 at 12:26 am

    This is great. With the addition of a 1TB hard drive to my PC, I got quite tired of manually using Vista's Backup and Restore Center each and every time I wanted to make a simple weekly backup without having to download some other third party app. The answer? Automate it with Task Scheduler! I used this guide http://maximumpcguides.com/windows-vista/schedule-a-complete-pc-backup/

Leave a Reply

Your email address will not be published. Required fields are marked *