Top Nav

Make Windows Run Disk Cleanup Automatically with Task Scheduler

Running Disk Cleanup regularly in Windows is an important part of keeping your system running smooth. Here’s how to create a Scheduled Task to run this maintenance utility automatically.

Note: This will work with Windows 8, Windows 7, Vista, and XP

We previously showed you how to run Disk Cleanup and how to clean temp files it misses. But remembering to run it regularly is the tough part.

Set Windows to Run Disk Cleanup Automatically

First, some command line magic — click Start and type: cmd in the search box. Hit Enter.


At the command prompt type: cleanmgr.exe /sageset:1 then hit Enter.
Command Prompt

The Disk Cleanup Settings window opens. Click the files you want to have Disk Cleanup delete. Click OK and close out of the command prompt.

Disk Cleanup Settings

Create a Scheduled Task

To create the Scheduled Task click Start and type: task scheduler into the search box. Hit Enter.

Run Task Scheduler

When Task Scheduler comes up, you need to create a new task. Click Action and click Create Basic Task.

Create Basic Task

The Create Basic Task Wizard starts. Type in a name for the task and description. Click Next.

Basic Task Wizard

On the Task Trigger screen select how often you want to run it. Here I’m selecting Monthly.

Task Trigger

Next, select the date and time each month you want the task to run.

Run Monthly

Under Action select Start a Program.


In the Program/script field type: C:\Windows\system32\cleanmgr.exe.

In the Add Arguments field type: /sagrun:1 and click Next.

Start a Program

You’ll get a summary of the task you just created. Click Finish.


Now Disk Cleanup will run monthly at the selected time automatically.

Related Article:  Windows 8.1 Tip: Add Windows Defender to the Context Menu

Disk Cleanup

Nowadays more of our music and video is streamed from the cloud via services like Spotify, MOG, or Amazon Instant video. So, there’s less of a need to have gigabytes of media files stored.

Still, there’s plenty of people who still have large media collections on their computer hard drive. Even if the files aren’t ripped CDs or DVDs, there’s plenty of home videos and pictures that you might not trust to be saved on Google Drive or SkyDrive. I know I don’t like cloud services to default to automatically save my pictures. It’s more important to have them on my local Windows system.

Even though you might have less to store, and hard drive space is easy to come by these days, running cleaning up your hard drive regularly is still important for an overall healthy computer.

More Reading:

, ,

7 Responses to Make Windows Run Disk Cleanup Automatically with Task Scheduler

  1. Taos December 6, 2011 at 5:36 pm #

    Is there a way to run a job to delete all my cookies? Perhaps launch ccleaner (you talked about that recently) on a schedule?

  2. Brian Burgess December 6, 2011 at 10:07 pm #

    Most major browsers have the option to auto clear history and cookies when you exit it.
    Here’s an older article that talks about clearing cache, history and cookies in Firefox.

    You could create a bat file to do it, or I’m sure a scheduled task — something to look into for an article! Good idea Taos.
    Thanks for reading.

  3. Chaitanya January 12, 2012 at 10:38 pm #

    @Brian or anyone else Kindly please provide solution for below problems. Am using Windows 7.
    1. When I type ‘task scheduler’ in search field and Enter.In task Scheduler window under Action tab – “Create Basic task is disabled”. It shows Connect to remote computer.

    2. When I type ‘disk defragment’ in search field and Enter. It displays task scheduler service is not running.

    3. When I type ‘perfmon /report’ it displays path not found.

  4. Chris April 20, 2012 at 1:26 pm #

    Which string to cleanup old restore points except last to add to Task Scheduler reply asap 🙂

  5. Chris April 20, 2012 at 1:56 pm #

    How to run above from std User Account 🙂

  6. andy September 13, 2012 at 4:52 am #

    thanks for this great bit of info 🙂

  7. Clint May 22, 2013 at 11:06 am #

    Is there a kind of default set of files to check off or not check off for deletion?

Leave a Reply