Automate Disk Cleanup with cleanmgr /sageset and /sagerun
Save a cleanup profile once, then run it unattended on any schedule.
01Command
$ cleanmgr /sageset:102What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- cleanmgr - Windows CommandsEvidence: Documents cleanmgr /sageset:n to configure a saved cleanup profile and /sagerun:n to run it unattended.
- CleanMgr - Automated Cleanup of Temp FilesEvidence: 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
Run fragmentation consolidation on HDDs or the trim pass on SSDs, with progress output.
Read-only command that prints free, total and available bytes for any volume.
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.