Run | Command For Disk Cleanup [verified]
Subsequently, the command cleanmgr /sagerun:n executes the cleanup , using the exact settings saved during the sageset step. This is a breakthrough for automation. An administrator can create a scheduled task in Windows Task Scheduler to run cleanmgr /sagerun:1 every Friday night at 2:00 AM. The system will then automatically purge temporary files, recycle bin contents (if configured), and other digital debris without requiring a user to be logged in or to click a single button. This elevates the Run command from a mere launcher to a strategic tool for proactive system health management.
If you want to bypass the graphical interface and directly clean up files without user interaction, you can use:
If you want to automate disk cleanup tasks, consider setting up a task via Task Scheduler:
To start the Disk Cleanup tool and specify the hard disk to be cleaned by using the command line, follow these steps: Click Start, Microsoft Support cleanmgr | Microsoft Learn run command for disk cleanup
You can run this command directly in or PowerShell (Admin) .
However, before running this command, you must first set up what files to delete by running the Disk Cleanup tool once manually.
Another nuance of the cleanmgr command is its ability to target non-system drives. By default, cleanmgr cleans the drive where Windows is installed. However, the Run command allows for precise specification. Typing cleanmgr /d D: will open the Disk Cleanup tool specifically for the D: drive, scanning for recycle bins and temporary files on that volume. Furthermore, the /lowdisk parameter automatically runs the standard cleanup with default settings without opening the GUI, designed for situations where a drive is critically low on space (less than 200 MB). For example, an emergency response script might use cleanmgr /d E: /lowdisk to instantly free up space on an external drive that is failing a backup due to insufficient capacity. The system will then automatically purge temporary files,
Instead of just running the generic Windows Disk Cleanup tool ( cleanmgr.exe ), this feature executes a PowerShell script that performs a "Smart Cleanup" before the standard GUI opens. It intelligently clears temporary caches (like Windows Update cache, thumbnail caches, and error reports) that the standard tool often misses or requires manual checkbox selection for.
To run the Disk Cleanup tool on a Windows computer, you can follow these steps or use the command line. Here are the methods:
cleanmgr /d c: /f
This saves the user from the tedious process of manually selecting categories every time and frees up significantly more disk space automatically, which is especially useful for IT administrators running scripts or users with low disk space warnings.
The command cleanmgr /sageset:n , where n is a number from 0 to 65535, opens a hidden, of the Disk Cleanup interface. While the standard user interface may show a dozen options, the sageset view displays dozens more, including the ability to delete “System Error Memory Dump Files,” “Old Chkdsk Files,” “Windows ESD Installation Files,” and even “Previous Windows Installations” (Windows.old). The user can carefully select which categories to target, and the configuration is saved to the registry under the specified number n . This is a one-time configuration step.