Save a Disk Cleanup preset and run it in one go — via Microsoft Learn
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
- Run
cleanmgr /sageset:1from an elevated prompt, tick the categories you want and click OK. Nothing is deleted yet. - Run
cleanmgr /sagerun:1whenever you want to clean with that preset. The number can be anything from 0 to 9999. - Other switches:
/lowdiskopens with every category pre-ticked, and/verylowdiskcleans everything without asking.
Command
Run in an administrator Command Prompt / Terminal window.
cleanmgr /sageset:1
cleanmgr /sagerun:1The preset is saved as aStateFlags0001DWORD (0 or 2) under each handler inHKLM\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
- cleanmgr — by Microsoft Learn
- Automating Disk Cleanup tool in Windows — by Microsoft Learn
- 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.