Disk Cleanup is an essential Windows system tool which allows you to delete various unnecessary files created by the OS to save your hard disk space. By default it works in a simpler mode which allows you to delete only files related to your current user account. You can switch it to the extended mode, which allows you delete more unused files used by Windows Updates, or service packs and so on. When you start the Disk Cleanup app, you have to switch every time to the extended mode by clicking the Clean up system files button. Thus it has to calculate how much disk space you will free up twice which may take a lot of time. It is possible to speed this up and open the extended mode directly. Let's see how.
Before you continue, I suggest you to check out the following article:
Disk Cleanup (Cleanmgr.exe) Command Line Arguments
How to directly open Disk Cleanup in system files mode
There is a trick which allows you get the extended mode of Disk Cleanup right after it starts. All you need to do is to run the Disk Cleanup tool as administrator.
- Type cleanmgr at the Start screen or in your Start Menu search box.
- Press Ctrl+Shift+Enter to open it directly as administrator.
Running it as administrator is the same as starting it normally and then pressing the "Clean up system files" button. This will save you time and a few additional mouse clicks.
How to run Disk Cleanup faster without having it calculate how much disk space you will free
To bypass the used space calculation, you need to use a special command line argument, as described below.
- Open an elevated command prompt
- Type the following:
cleanmgr /D C /sageset:65535 & cleanmgr /D C /sagerun:65535
Press Enter.
The Disk Cleanup application will be opened instantly as it does not calculate how much disk space you will free up. You will notice that the total amount of space that you gain is not even displayed. In this window, you must select the items that you want Disk Cleanup to clean after you click the OK button.
Note the /sageset switch. The sageset:<number> switch allows you to configure what kind of cleanup to perform in advance so that when you use the same number but run Disk Cleanup with the /sagerun switch, it will directly cleanup the items you selected. The number can be anything from 1 to 65535. Also, note the /D argument. It allows you to specify a drive to clean up. In the example above, i use /D C argument to perform the cleanup of my C drive. In the example above, I've combined both commands at the command prompt in one line using the '&' char. It will execute them one after the other.
Bonus tip: you can also add the Extended Disk Cleanup item to the context menu of drives in This PC/Computer folder.
Just merge the following Registry tweak:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Drive\shell\runas] @="Extended Disk Cleanup" "HasLUAShield"="" "MultiSelectModel"="Single" "Icon"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,00,79,\ 00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6c,00,65,00,61,00,6e,00,\ 6d,00,67,00,72,00,2e,00,65,00,78,00,65,00,2c,00,30,00,00,00 [HKEY_CLASSES_ROOT\Drive\shell\runas\Command] @="cmd.exe /c cleanmgr.exe /sageset:65535 & cleanmgr.exe /sagerun:65535"
It will open Disk Cleanup in the system files cleanup mode instantly right from the context menu and will perform cleanup with the options you selected.
Click here to download ready-to-use registry tweak
That's it.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
I’m having trouble finding “Extended Disk Cleanup item to the context menu of drives in This PC/Computer folder”, after running the .reg file with success indicated. Using Windows 7 Enterprise, 64-bit. Does it require a reboot to see this newly added context menu item? Or, is that a Windows 8 trick only?
Thanks
Should work in Windows 7 too.
Hi Sergey,
I just checked once more, and this time I see the Extended Disk Cleanup in the context menu. It worked as advertised. Not sure why it was missing yesterday, unless if a reboot is required (eg. this registry key is only read during bootup), or possibly a log-off /log-on would have been enough.
Thanks,
Tom
I am happy to be helpful.
This might not be the place to ask such a generic question but; how can I execute Extended Disk Cleanup item from context menu with elevated priviliges – without using any 3rd party app/software, PowerShell script, VB etc. script. A lame solution that came to my mind is using Command as the filename of an elevated shortcut to batch which contains the line above (%windir%\system32\cleanmgr.exe /sageset:65…). What would you recommend?