Home / Windows / Automatically Run Disk Cleanup and Delete Unnecessary Files

Automatically Run Disk Cleanup and Delete Unnecessary Files

Today I will show how to Cleanup you hard drives automatically with the Disk Cleanup tool. It will save your time and you can forget to run a Disk Cleanup manually. The Disk Cleanup deletes unnecessary files from your computer making space for new content. Let’s do this:


How to automate Disk Cleanup on your PC

  1. Run Command Prompt with Administrator Privilege.
  2. Type the following command and press Enter:

cleanmgr /sageset:11

In this command, we’re using the switch /sagest:n to open the Disk Cleanup settings and at the same time create a registry key that will store the settings you choose. The n number, which is also stored in the registry, indicates the settings you want to use with the tool.

The number can be anything from 0 to 65535, and it’s basically like a filename that points to all the specific settings you want to use. This way, you can set different numbers to run the tool with different settings at different times.

  1. Once the Disk Cleanup Settings opens, check the items you want the tool to remove automatically from your system from the extensive list. Some of the files you can clean up include:
    • Windows Update Cleanup
    • Downloaded Program Files
    • Temporary Internet Files
    • Temporary files
    • System error memory dump files
    • Files discarded by Windows upgrade
    • Windows ESD installation files
    • Previous Windows installations
    • Recycle Bin
    • Temporary Windows installation files
  2. Click the OK button to save and store the settings in the registry.
  3. Open Start, do a search for Task Scheduler and click the result to open the utility.
  4. Right-click Task Scheduler Library, click New Folder and name the folder something descriptive like User Defined Tasks.
  5. Right-click the newly created folder and click Create Basic Task.
  6. Name the task, add a description you like, and click Next.
  7. Select when you want the task to run and click Next. These options are very flexible as you can set different times, in addition to set specific events to trigger the task. For the purpose of this guide, we’ll be choosing Weekly.
  8. Select the date and time, and click Next.
  9. On Action, select Start a program and click Next.
  10. Type the path to open the Disk Cleanup tool: C:\Windows\system32\cleanmgr.exe and include the argument /sagerun:11. (Remember to change the number 11 to the number you that you chose in step 2 to use the settings you have configured.)
  11. Click Next.
  12. On the Summary page, click Finish to complete the task.

After completing the task, the Disk Cleanup tool will run at the time you specified, deleting all unnecessary files from your computer. If for any reason, you need to change the current settings for the task, open the Task Scheduler, open the folder you created, double-click task, and update the configuration.


Enjoy! 🙂

About Ahmadnan

Check Also

See Through Wallpaper for iPhone X

Thanks to ifixit.org for introducing wallpapers by using which you can make your iPhone X more ...

Leave a Reply

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


Powered by themekiller.com anime4online.com animextoon.com apk4phone.com