Automate Disk Cleanup with cleanmgr /sageset and /sagerun

Save a cleanup profile once, then run it unattended on any schedule.

WindowscleanupcmddiskLow risk
Run `cleanmgr /sageset:1` to pick categories once, then `cleanmgr /sagerun:1` to run them unattended.

01Command

Command
$ cleanmgr /sageset:1

02What it does

cleanmgr /sageset:1 opens the category dialog and stores your selection under the registry key VolumeCaches, without deleting anything yet. Afterwards /sagerun:1 silently cleans exactly those categories, which makes it ideal for scheduled tasks or one-click shortcuts. This is the classic way to clear temp files, thumbnails, Delivery Optimization files and update leftovers on many machines at once.

03Risk

RiskLow risk
!Warning: Review the /sageset checkboxes carefully: deleting the Downloads category or previous Windows installations is not reversible.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • cleanmgr - Windows Commands
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents cleanmgr /sageset:n to configure a saved cleanup profile and /sagerun:n to run it unattended.
  • CleanMgr - Automated Cleanup of Temp Files
    SS64 · technical · 2026-09-17
    Evidence: Explains the sageset/sagerun workflow and the registry location where the cleanup profile is stored.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions