Skip to content

Save a Disk Cleanup preset and run it in one go — via Microsoft Learn

Commandlow riskNeeds adminWindows 11Windows 10

Disk Cleanup has hidden switches. /sageset:n lets you tick the categories you want and saves them as preset number n. /sagerun:n then cleans exactly those without asking, which makes it easy to put in a shortcut or a scheduled task.

Takes effect right away

The easy way

  1. Run cleanmgr /sageset:1 from an elevated prompt, tick the categories you want and click OK. Nothing is deleted yet.
  2. Run cleanmgr /sagerun:1 whenever you want to clean with that preset. The number can be anything from 0 to 9999.
  3. Other switches: /lowdisk opens with every category pre-ticked, and /verylowdisk cleans everything without asking.

Command

Run in an administrator Command Prompt / Terminal window.

cleanmgr /sageset:1
cleanmgr /sagerun:1
The preset is saved as a StateFlags0001 DWORD (0 or 2) under each handler in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches. To change it, run /sageset:1 again. The files it deletes can't be brought back, so check the list (for example Downloads, if shown) before you save the preset.

Sources

Source reviewed
2026-11-02
Link checked
2026-11-02
Tested hands-on
Not by Oddbyte.Me

Oddbyte.Me hasn't tried this on every Windows build, so keep the undo handy.

disk cleanupcleanmgrsagesetsagerunfree space

More in Hidden Tools & Commands

Download a full macOS installer from Terminal — via SS64

Commandlow risk

softwareupdate can list and download complete macOS installers, including older versions Apple still serves. Useful for making a bootable USB installer or installing on another Mac without hunting through the App Store. This entry only downloads; it doesn't install anything.