Disk Cleanup is a built-in Windows tool that helps end user clean up disk spaces. Normally, you can launch the tool from disk drive’s properties, like below.
But do you also know that it can be launched as a command line with a bunch of switches that can be useful in various situations?
Let’s see how many switches are available in the tool by running the following command from a Run dialog box.
Addition to that, you can use the following switch to run the tool on a specified disk drive.
For example, running
cleanmgr.exe /d c
launches the Disk Cleanup Tool for drive c:.
The switch /LOWDISK is used when a disk drive is running low in disk space. When launched, Disk Cleanup tool opens with all checkboxes checked by default.
cleanmgr.exe /lowdisk /d c
The command will launch Disk Cleanup tool against the drive c with all checkbox checked by default.
Click OK to start the cleaning process.
If you want the process to start automatically, use the switch /VERYLOWDISK instead. It does exactly the same as the /LOWDISK does but starts the cleaning process automatically.
cleanmgr.exe /verylowdisk /d c
Also, running the above command line from an elevated command prompt window will switch to the System Files mode, the mode when you click Clean up system files button in the screenshot above.
If you would like to have a customized checkbox settings, you can use the switch /SAGESET to set up the settings and /SAGERUN to use it. For example,
will save the checkbox settings in the registry and then can be called up by using
Lastly, the /SETUP switch analyzes the system files left from a previous Windows version. If you are one of the Windows insiders, you will find this very helpful.
It will analyze the following locations:
C:\$Windows.~BT\* C:\$Windows.~LS\* C:\$Windows.~WS\* C:\ESD\Download\* C:\ESD\Windows\* C:\$WINDOWS.~Q\* C:\$INPLACE.~TR\* C:\Windows.old\* C:\Windows\Panther
and saves two log files for you to inspect:
To automatically clean up these left behind system files, use /AUTOCLEAN instead.
Latest posts by Kent Chen (see all)
- Recovering Data Encrypted by WannaCry Ransomware - May 19, 2017
- Outlook Tip: What To Do When Receipt Receives Winmail.dat Attachment from You - May 19, 2017
- Whom to Blame: Stealing Windows Credentials Using Google Chrome - May 17, 2017
Last updated: 03/20/2017