Windows disk cleanup graph
Intermediate

How to configure automatic Disk Cleanup in Windows 7

Windows disk cleanup graph

Instead of remembering to run “Disk Cleanup” in your computer, would not be better an automatic process that will do it for us? That’s what we are going talk about; how to configure automatic “Disk Cleanup” using Cleanup Manager and Task Scheduler in Windows 7.

Really brief, Cleanup Manger was designed to help you to get rid of unnecessary files from your hard drive, freeing up space for more important data.

To create an automated Disk Cleanup process is pretty simple, just follow these steps:

First, we need to configure Cleanup Manager to delete all unnecessary files.

1 Click Start in the search box Search programs and files type cmd; in the search result under Programs title, right-click on CMD and select Run As Administrator.

How to run application as administrator

2. The Command Prompt window will open, then type cleanmgr /sageset:13 (the #13 could be any number from 0 to 65535) and hit Enter. 

Command Prompt Window

3 In Disk Cleanup Settings select from the list all file types you would like to delete and click OK, now these settings are saved in your computer registry (sageset:13).

Disk Cleanup Settings  

Second, with the Task scheduler we are going to configure how and when to execute Disk Cleanup with the settings you’ve chosen.

4 Repeat step 1 but now type task scheduler, in Programs Right Click Task Scheduler and select Run As Administrator.

5 Next, Right Click Task Scheduler Library select New Folder and name it My Tasks (this step is just to keep tasks organized).

New task folder

6 Right-click in the newly create folder My Tasks and select CREATE TASK.

7 Choose a name for the task, like: AutoCleanUP and go to the next tab Triggers.

Disk Cleanup general settings

8 In the Triggers tab click New, click on the Begin the Task: and choose how you’d like to execute the task and pick and configure the Settings section any way you like. For this scenario I am going to select On a Schedule.

Note: I would recommend scheduling a time that your computer is ON and you are logged in.

Next, in Advanced settings select Stop task if it runs longer than and choose 1 hour, and Click OK.

Disk Cleanup trigger settings

9 Go to “Actions” tab, click New, make sure that Start a program is selected in the Action.

In Program/script type C:\Windows\System32\cleanmgr.exe and in Add arguments (optional), type /sagerun:13 (remember that is the number that you’ve chosen earlier in step 3) with the sagerun we are calling the settings stored in sageset:13 that we already configured, and click OK. 

Disk Cleanup Action settings

10 Go to Conditions these options are self-explanatory so choose the ones that suit your needs and go to Settings tap.

11 In Settings just select Run task as soon as possible after a scheduled start is missed and If the task fails, restart every:, and leave the default 1 minute and 3 times, and click OK.

Disk Cleanup settings tab

12 Now that Cleanup manager and the Task scheduler are setup and configured, we should test the task to see if it is working. To test, select the task (Right Click on it), and selectRun, once you see the Disk Cleanup process window you will know that it is working.

Run Task 

Disk Cleanup working

Pureinfotech Video Tutorial

Conclusion

We work, learn, and play with our computers, but how often we do some sort of maintenance?

This method shown today it is not a complete computer maintenance process but it is a big part of it, and the process is fairly easy it should not take more than 10-20 minutes to configure. Now you can keep using your computer without worrying about doing a Disk Cleanup because it is now automated.

  • Anonymous

    You said that “process is pretty simple”, but it takes 12 steps and a lot of “digging” in the inners of stuff… I wouldn’t say it’s simple, even so thanks for the tutorial. BTW… “sageset:13 (the #13 could be any number from 0 to 65535)” – what exactly that chosen number does in the process?

    • http://Pureinfotech.com Pureinfotech

      I think that what I meant by “process is pretty simple” was that even though it takes 12 steps, you are not required to be a IT professional to do this : )
      Now, the number in this case “#13″ you can think it as a block of space where you are going to save settings, for example think of “sageset” as a container where you are going to save “13″ and inside the “13″ you have the clean up settings. You can save different settings with different numbers.
      If in the future you can call sageset:13 to clean certain things or sageset:14 to clean other things, and so on and so forth. I hope this answer your question!

      Thank you for taking the time to leave a comment!

  • Biensangs

    wow, Thank You

    • mhweb

      I am glad it helped!