Advertisement

Create a Preset for Cleanmgr (Disk Cleanup)

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)

  1. Open an elevated command prompt.
  2. 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: cleanmgr-sageset-run-dialog

  3. Tick the options you want to be enabled for this preset as shown below:sageset-in-action
  4. 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.

  1. To run your preset in the current user context, press Win + R. In the Run box, type
    cleanmgr.exe /SAGERUN:your preset number

    sagerun-in-the-run-dialog

  2. To run your preset in system files mode, open an elevated command prompt and type the following command
    cleanmgr.exe /SAGERUN:your preset number

    cleangr-sagerun-elevated
    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

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.