The built-in Windows tool, Disk Cleanup, which can be launched as cleanmgr.exe from the Run dialog, supports a number of interesting command line arguments which can be useful in various situations. A couple of its options can be used to create a preset of checked options by default. Once you make a preset only with items you need to clean up, you can launch it any time later. This is very useful.
Advertisеment
This trick is not new. In Windows 8.1, I used it to clean system files directly. If you are interested, you can read the following article:
How to run Disk Cleanup directly in the system files mode and speed it up
If you read the article "Disk Cleanup (Cleanmgr.exe) Command Line Arguments in Windows 10", you might be already familiar with two command line arguments: /SAGESET and /SAGERUN.
The /SAGESET command line argument can be used to create a preset, then the /SAGERUN option can be used to launch the preset. Let's see how it can be done.
Create a Preset for Cleanmgr (Disk Cleanup)
- Open an elevated command prompt.
- Type the following command
cleanmgr.exe /SAGESET:number
The number is a unique identifier for your preset. Think of it as the name of your preset. It be any value from 0 to 65535.
Suppose you use the number 112, for example: - Tick the options you want to be enabled for this preset as shown below:
- Click OK to save the preset under the number you entered in the elevated command prompt.
Voila, you just created your own preset for Disk Cleanup. Let's see how to launch it.
How to run your preset for the Disk Cleanup tool
You can run the preset in user mode and in system files mode. In user mode, it won't clean items which are not accessible to the current user. In system files mode, cleanmgr.exe runs elevated, so all options will be cleaned.
- To run your preset in the current user context, press Win + R. In the Run box, type
cleanmgr.exe /SAGERUN:your preset number
- To run your preset in system files mode, open an elevated command prompt and type the following command
cleanmgr.exe /SAGERUN:your preset number
It will start cleaning up using the pre-selected options automatically.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!
Advertisеment