dc_top

The Disk Cleanup tool has been around in Windows for years. It offers a quick way to remove temporary, cache, and other non-essential files to help you free up some disk space. You can even use it to remove old versions of Windows after an upgrade to Windows 10. Disk Cleanup also has several hidden options that you can only access if you run it from the Command Prompt or a custom shortcut.

Start by opening the Command Prompt with administrative privileges. Press Windows+X and choose “Command Prompt (Admin)” from the list of commands.

dc_1

At the Command Prompt, type the following command and then press Enter.

cleanmgr /sageset:65535 /sagerun:65535

dc_top

Note that where this command uses the number 65535, you can actually use any number between 1 and 65535 as long as you use the same number in both places. The reason for this is that the cleanmgr command offers some other customization and automation features. Disk Cleanup remembers options, so you could create batch files or scripts that ran cleanup in different ways based on the set number you use. Here, we’re just exposing the hidden cleanup options, but if you’re interested, Microsoft has some good information about automating Disk Cleanup.

After you run the command at the Command Prompt, the Disk Cleanup interface will load. Unlike when you run it the regular way, it will not ask you which disk you want clean up. Instead, options you choose will apply to all disks. As you can see, the tool now offers several options that are unavailable if you run Disk Cleanup normally.

dc_2

If you want to run Disk Cleanup this way regularly, you can also create a shortcut. To do this, you’ll first need to run the command using the Command Prompt as we just discussed. This creates a configuration entry in the Registry using the sageset number you chose (we’re still using 65535). Then, you’ll need to create the new shortcut. Just right-click on your Desktop (or any folder where you want to save the shortcut) and choose New > Shortcut. In the Create Shortcut window, paste (or type) the following text into the “Type the location of the item” box and then click Next.

%systemroot%\system32\cmd.exe /c Cleanmgr /sagerun:65535

dc_3_v2

Give your shortcut a name and then click Finish to save it.

dc_4

Now, all you have to do is double-click that shortcut to run Disk Cleanup with advanced options against all the drives on your system. It won’t necessarily save you a huge amount of extra space, but sometimes every little bit helps. It also offers a nice way to run Disk Cleanup against multiple drives at once.

Walter Glenn Walter Glenn
Walter Glenn is the Editorial Director for How-To Geek and its sister sites. He has more than 30 years of experience in the computer industry and over 20 years as a technical writer and editor. He's written hundreds of articles for How-To Geek and edited thousands. He's authored or co-authored over 30 computer-related books in more than a dozen languages for publishers like Microsoft Press, O'Reilly, and Osborne/McGraw-Hill. He's also written hundreds of white papers, articles, user manuals, and courseware over the years.
Read Full Bio »