Automating Disk Cleanup with cleanmgr Command-Line Options
Download nowcleanmgr.exe supports command-line switches that let you save a cleanup profile and re-run it silently, including on a schedule.
Updated August 9, 2026 · PC Utility Hub Editorial Team
Create a cleanup profile with /sageset
The /sageset switch opens the full Disk Cleanup category list (including system file categories, no elevation prompt needed for the file-system-files button) and saves your selections under a numeric profile ID stored in the registry.
- 1Run the command above from an elevated Command Prompt or Run dialog.
- 2Check every category you want included in this profile.
- 3Click OK; nothing is deleted yet, only the profile is saved.
cleanmgr /sageset:1Run a saved profile with /sagerun
Once a profile is saved, /sagerun executes the cleanup for that ID with no dialog, deleting files matching your saved choices immediately.
cleanmgr /sagerun:1Warning: There's no confirmation prompt with /sagerun. Files matching the saved categories are deleted immediately, so review the profile carefully with /sageset first.
/verylowdisk for automatic low-space cleanup
/verylowdisk runs cleanup automatically without any user interaction, intended for scenarios where disk space is critically low, such as OOBE or automated deployment scripts. It selects a default set of safe categories without requiring a saved profile.
cleanmgr /verylowdiskAutomate with Task Scheduler
- 1Save a profile first with `cleanmgr /sageset:65` (any unused number).
- 2Open Task Scheduler and create a new task.
- 3Under Actions, set the program to `cleanmgr.exe` and arguments to `/sagerun:65`.
- 4Set a trigger, such as weekly or at logon.
- 5Under General, check "Run with highest privileges" so system file categories are included.
Other useful switches
| Switch | Purpose |
|---|---|
| /d <drive> | Target a specific drive letter |
| /sageset:n | Open full category picker and save as profile n |
| /sagerun:n | Silently run cleanup profile n |
| /verylowdisk | Run a default cleanup with no UI, for low-space situations |
| /lowdisk | Similar to /verylowdisk but shows a confirmation dialog |
Frequently asked questions
- Does /sagerun ask for confirmation before deleting?
- No, it deletes files matching the saved profile immediately without a prompt.
- Can I run cleanmgr for a non-system drive?
- Yes, use the /d switch, e.g. `cleanmgr /d D: /sagerun:1`.
- Is there a PowerShell-native alternative?
- Storage Sense can be configured via Settings or Group Policy for similar automated cleanup without cleanmgr.
Related pages
- Disk CleanupThe classic Windows disk cleanup program, still available in Windows 10 and 11, for reclaiming drive space.
- Disk Cleanup on Windows 11Run Disk Cleanup and pair it with Storage Sense on Windows 11 for a thorough space cleanup.
- Disk Cleanup on Windows 10Run Windows 10 Disk Cleanup step by step, plus notes for the older Windows 7 version.
- PC Maintenance ChecklistA recurring checklist of built-in Windows tools for disk, update, and drive maintenance.