
close
close
Running out of disk space isn’t a new problem to IT pros. Since the introduction of Windows XP, Microsoft’s Disk Cleanup utility helps users free disk space that’s eaten up by system settings, temporary files, and more. The tool can be used both manually or automated by using the command line and Windows Task Scheduler.
To manually run the Disk Cleanup utility, do one of the following:
1. Open Windows Explorer, right click on the C:\ drive, and select Properties.
2. In the Properties window, click “Disk Cleanup.”
Selecting the Disk Cleanup utility. (Image Credit: Daniel Petri)
advertisment
Running Disk Cleanup from the Start menu in Windows 10. (Image Credit: Daniel Petri)
Cleanmgr.exe
Opening Disk Cleanup through the command prompt. (Image Credit: Daniel Petri)
Disk Cleanup is calculating how much time it takes to run. (Image Credit: Daniel Petri)
advertisment
Disk Cleanup utility can be used to remove a number of items. In Windows 10, Disk Cleanup offers eight cleaning options.
Disk Cleanup options. (Image Credit: Daniel Petri)
There are many more options you can choose from. If you click on the “Clean up system files” button, you get these additional cleanup options:
advertisment
And even then there are more options, but some of them are not available through the regular UI. To see a full list of Disk Cleanup option:
1. Open Command Prompt with administrative permissions.
2. Type in the following line (just copy and paste), then press Enter:
FOR /F "usebackq tokens=8 delims=\" %i IN (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"`) DO @echo %i
Additional DiskCleanup options. (Image Credit: Daniel Petri)
Now, if we want to run the Disk Cleanup from the Command Prompt and have it run the cleaning process without any user intervention, we need to prepare the system first.
1. In the Run command, type the following line, and press Enter:
cleanmgr /sageset:1
Running Disk Cleanup from the command prompt. (Image Credit: Daniel Petri)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
Now, manually select any option, and you can click on the “Clean up system files” button to get even more options.
Note: Unlike my previous example, running Disk Cleanup via the command prompt does not show you how much disk space it’s going to free. This is the setup stage, no calculation is done.
If you execute cleanmgr /sagerun with the same number, it will perform the tasks defined in the “sageset” command.
1. In the Run command, type the following line, and press Enter:
cleanmgr /sagerun:1
Before running the command, I had 33.9 GB free space on the C:\ drive. After running the command, I had 47.5 GB free space on the C:\ drive.
Result of freed disk space after running Disk Cleanup in Windows 10. (Image Credit: Daniel Petri)
More in Windows 10
Microsoft to Start Notifying Windows 8.1 Users About Upcoming End of Support
Jun 24, 2022 | Rabia Noureen
Microsoft's Out-Of-Band Patch Fixes Microsoft 365 and Azure AD Sign-In Issues on ARM Devices
Jun 21, 2022 | Rabia Noureen
Microsoft is Investigating Sign-In Issues Affecting Microsoft 365 and Azure AD on ARM Devices
Jun 20, 2022 | Rabia Noureen
Microsoft to Fix Windows Bug Breaking Wi-Fi hotspots After Installing Latest Patch Tuesday Update
Jun 17, 2022 | Rabia Noureen
Microsoft's June 2022 Patch Tuesday Updates Fix Several Remote Code Execution Vulnerabilities
Jun 15, 2022 | Laurent Giret
Most popular on petri