Automate Enhanced Disk Cleanup Tool for Windows 7 & 8

By Anand Khanse for The Windows Club

Automate Enhanced Disk Cleanup Tool for Windows 7 & 8

We have earlier seen that the command line version of the Disk Cleanup Utility in Windows offers many more clean-up options. Just earlier today, we saw how we can force Disk Cleanup Utility to delete ALL temporary files, including those temporary files created in the last 7 days.

In this tutorial, we will see how to activate some additional cleaning options and automate the cleanup operation, so that you don’t need to run the Disk Cleanup Utility or Cleanmgr.exe in Windows 8 or Windows 7 manually, every time.

Command line version of Disk Cleanup Utility or Cleanmgr.exe

To begin, open an elevated command prompt, type cleanmgr /sageset:n, where n can be any integer between 1 and 255.


This switch /sageset displays the Disk Cleanup Settings dialog box and creates a registry key to store the settings. The number denote the settings which will be stored in the Registry when your run sagerun switch later on – and basically lets you make shortcuts to different stored configurations or schedule automatic cleanup in the Task Scheduler. In effect the /sagerun:n switch will run the specified tasks that are assigned to the n value by using the \sageset switch.

Lets begin with cleanmgr /sageset:1. This will open the Command Line version of Disk Cleanup Utility offering many more cleanup options.



Article continued here

This excerpt appears with the permission of The Windows Club.

Stop Responding to Threats.
Prevent Them.

Want to get monthly tips & tricks?

Subscribe to our newsletter to get cybersecurity tips & tricks and stay up to date with the constantly evolving world of cybersecurity.

Related Articles