Lots of utilities in Windows are context-sensitive. In other word, this means they look at the state of your system, then structure themselves to present options based on what they find. The Disk Cleanup utility aka Cleanmgr.exe is a case in point. If it doesn’t find certain files in need of cleanup, it ordinarily won’t tell you about them. That said, I found a “trick” to get the utility to show you all disk cleanup options for any drive you point it at. This includes those options that only appear otherwise when you click the “Clean up system files” button in the results window after an initial scan.
Show Me All Disk Cleanup Options in Windows 10
The trick to seeing all disk cleanup options hangs on a couple of command-line switches for the Disk Cleanup utility. Instead of running it through the GUI or via File Explorer, you must launch a command line prompt with admin privileges. The easiest way to do this is to strike the Window-key + X key combination, and then to select the Command Prompt (Admin) entry on the resulting pop-up menu. Inside that command window you then enter the following string:
%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:<n> & Cleanmgr /sagerun:<n>
In this instruction, you must pick the same 16-bit number for both instances of <n>, which must be a value between 1 and 65535. You can cut and paste the command line shown, but you must supply a value for both instances of n (and drop the angle brackets <>) before the command will run. Here’s a great TechNet Magazine Tip that explains what’s going on in detail. The number ties into a specific registry key in Windows, and may be used to automate the same set of options that you pick in the Disk Cleanup GU. Thus, you can run this same set of selections over and over again in a scheduled batch job by referencing that same syntax later on. Obviously, you can also create a total of 65,535 sets of options (though that is waaaay more than you’ll ever need). You only need to use the /sageset option once to set things up for the first time; after that use only the /sagerun option to repeat those same settings.
Here’s a complete set of the Disk Cleanup options that this produced, several of which I’d never, ever seen before. It’s a series of 5 screen caps each of which shows 5 checkbox items from the GUI interface in the “Files to delete:” pane. Here goes:
All Disk Cleanup Options, 1 of 5.
All Disk Cleanup Options, 2 of 5.
All Disk Cleanup Options, 3 of 5.
All Disk Cleanup Options, 4 of 5.
All Disk Cleanup Options, 5 of 5.
Count ’em up folks: that’s 25 options in all. I had never even seen 4 or 5 of them before, including “Old Chkdsk files,” “System error memory dump files” (and minidumps), “Windows ESD installation files,” and “Update package Backup Files.” Others appear only rarely, as when cleaning up after a Windows upgrade. But here they are all at once and all together. I’m jazzed, and I hope you might be, too!