Guide | How To [Tutorial] What is/How to use Disk Cleanup Tool (Cleanmgr.exe)

The associated guide may contain user-generated or external content.

Aura

Level 20
Thread author
Verified
Jul 29, 2014
966
Hey guys, Aura here with my second tutorial imported on malwaretips.com !

A lot of people don't know about Windows in-built features or barely use them. Most of the them, it's these native applications that are the most useful in different situations as they allow you to manage/interact Windows in a way that most third applications can't or don't. It's this different interaction that allows these applications and utilities to give better results than if you were using a third-party software. Windows have a ton of in-built features and applications and today, we'll explore more in-depth one that I consider being one of the most useful there is and that I use all the time, the Disk Cleanup tool (CleanMgr.exe)

What is Cleanmgr.exe and when to use it ?

Cleanmgr.exe is an in-built Windows feature that allows you to clean many files and folders that are Windows specific and that aren't really needed. These files can accumulate overtime, taking useless space on your HDD that you might want to gain back when you don't have a lot of storage left on it.

When it happens, you should always run Cleanmgr first as it will allow you to gain back enough disk space to give the ability to move freely around your drive to clean it (uninstall programs, download/install CCleaner and run it, etc.).

The Cleanmgr is also the best, safest and fastest way to get rid of your precedent Windows installation folders. You know when you reinstall Windows, you'll sometime notice a windows.old, or windows.000 folder directly on your C: drive ? Well this (or these if you have multiple of them) is a folder containing your past Windows installation and can take up a lot of space on your HDD. So if you don't need it anymore and you want to retrieve that space back, using Cleanmgr is the best way to do that.

How to use Cleanmgr.exe ?

To launch Cleanmgr, you can pass via the Windows Start Menu or the Run Command. Both ways works however, I find the Start Menu option faster if you're running Windows 7 or Windows 8/8.1 with a Start Menu that have the search bar in it.

To launch Cleanmgr from the Start Menu
  • Click on the Windows Start Menu (or your alternate Start Menu if you have Windows 8/8.1);
  • Type "cleanmgr" ("cleanmgr.exe" works too) in the search bar;
  • Click on the cleanmgr icon that shows up in the results;

- WARNING - PICTURE AHEAD -
adQndpr.png

To launch Cleanmgr from the Run command
  • Press on the Win Key + R at the same time;
  • Wait for the Run box to open;
  • Type "cleanmgr" ("cleanmgr.exe" works too) in the Run box;
  • Press Enter;

- WARNING - PICTURE AHEAD -
exVPMie.png

After that, Cleanmgr will ask start and ask you to select the drive on which to run the scan. By default, the C: drive (where Windows is installed) is selected, and that's the one you usually want to clean. However, you're free to run pick any other drives for that scan. Be sure to pick the same drive later when you select "Cleanup system files" (if you're running Windows Vista or higher). Once you selected your drive, just click on Ok to launch the scan (research).

- WARNING - PICTURE AHEAD -
eB3tYJQ.png

RYNVR1l.png

Once Cleanmgr is done scanning for the files to delete, a window will appear with different checkboxes, each corresponding to one specific type of files to delete. From there, just check the checkboxes of the files you want to delete (I suggest you to check all of them) and click on "Ok" when you're ready to delete them. If you click on a line, for some files, the "View files" button will appear. When clicking on it, it will open the folder location where these files are stored so you can see their path and what they are. However, I recommend you to click on "Cleanup system files" (requires Admin. Rights, hence the UAC icon) in order to have even more files to cleanup and gain back more space. Once you click on "Cleanup system files", the same pop up as when you launched Cleanmgr will appear and asks you to choose the drive you want to scan. Select your Windows drive (C:, selected by default) and then click on "Ok".

- WARNING - PICTURE AHEAD -
h5QHkn9.png

Wait for scan to finish once again and you'll get another window that looks exactly like the precedent one you had, but with new, added checkboxes and files. I suggest you to check every checkboxes and to click on "Ok". A warning box will appear, asking you if you're sure to delete all these files. Click on "Delete files" and wait until the scan is done. Once it's done, it will close automatically (the icon will dissapear from the task bar). That new window also offers you the "More options" tabs, which allows you to open your list of installed programs to uninstall them and also an option that will delete all your previous System Restore points except the most recent one.

- WARNING - PICTURE AHEAD -
dWbhgOP.png

ZDHx7oO.png

YBbHHS5.png

What does Cleanmgr.exe clean exactly ?

Cleanmgr.exe will clean a bunch of different files that were used in different situations on your system. All of them are related directly or indirectly with Windows, hence why the Cleanmgr.exe knows which ones to delete, where they are and what they do. You can see the description of every files deleted by clicking on them in the Cleanmgr.exe window box. For Windows Vista and above users, after launching Cleanmgr.exe and that it finishes it's scan, you'll have the option to scan more files by clicking on the "Cleanup system files" option. There, you'll be asked to select the partition on which you want to run that scan and another Cleanmgr.exe window will pop up after, with way more options. Options varies depending of the version of Windows that you are running. Some options aren't available for Windows XP users, like some are only available for users of Windows 8/8.1 and so on.

Here's a list of all the options you can come across using Cleanmgr on different version of Windows
This list isn't complete, there's many more items that show be part of it, depending of your version of Windows
  • Debug Dump Files : "Files created by Windows". Files created during debugging of programs to help with troubleshooting;
  • Downloaded Program Files : "Downloaded Program Files are ActiveX controls and Java applets downloaded automatically from the Internet when you view certain pages. They are temporarily stored in the Downloaded Programs folder on your hard disk.";
  • Temporary Internet Files : "The Temporary Internet Files folder contains webpages stored on your hard disk for quick viewing (cache). Your personalized settings for webpages will be left intact.";
  • Offline Web Pages : "Offline pages are webpages that are stored on your computer so you can view them without being connected to the Internet. If you delete these pages now, you can still view your favorites offline later by synchronizing them. Your personalized settings for webpages will be left intact.";
  • Recycle Bin : "The Recycle Bin contains files you have deleted from your computer. These files are not permently removed until you empty the Recycle Bin.";
  • Setup Log Files : "Files created by Windows". Mostly for setups (program installation, updates downloads, etc.);
  • Temporary Files : "Programs sometimes store temporary information in a TEMP folder. Before a program closes, it usually deletes this information. You can safely delete temporary files that have not been modified in over a week.";
  • Thumbnails : "Windows keeps a copy of all your picture, video and document thumbnails so they can be displayed quickly when you open a folder. If you delete these thumbnails, they will be automatically recreated as needed.";
  • Per User Archived Windows Error Reporting Files : "Files used for error reporting and solution checking." This is per user account;
  • Per User Queued Windows Error Reporting Files : "Files used for error reporting and solution checking." This is per user account;
  • Temporary Windows Installation Files : "Installation files used by Windows setup. These files are left over from the installation process and can be safely deleted.";
  • BranchCache : "Files created by the BranchCach service for data caching";
  • Windows Defender : "Non critical files used by Windows Defender." Mostly logs and such;
  • Windows Update Cleanup : Files and folders left behind by Windows Updates. Mostly stored on your Windows' root drive and the SoftwareDistribution store folder;
  • Hibernation File Cleaner : Files that are created when Windows enter the hibernation mode in order to store data and temporary files;
  • Previous Windows Installation(s) : "Files from a previous Windows installation. Files and folders that may conflict with the installation of Windows have been moved to the folders named Windows.old. You can access data from the previous Windows installations in this folder."
  • Game Statistic Files : Random statistics accumulated by Windows Games when you play them and stored in files;
  • Service Pack Backup Files : "Windows saves old version of files that have been updated by a service pack. If you delete the files, you won't be able to uninstall the service pack later.";
  • System Archived Windows Error Reporting Files : "Files used for error reporting and solution checking." This is for the whole computer (Windows);
  • System Queued Windows Error Reportinging Files : "Files used for error reporting and solution checking." This is for the whole computer (Windows);
  • Old chkdsk files : "When Chkdsk checks your disk drive for errors, it might save lost file fragments as files in your disk drive's root folder. These files are unecessary and can be removed."
  • System Error Memory Dump Files : "Remove system error memory dump files.";
  • SYstem Error Minidump Files "Remove system error minidump files" These files are created during BSODs (Blue Screens of Death) when the physical memory is being dumped to the disk;
  • Files Discarded by Windows Upgrade : "Files from a previous Windows installation. As a precaution, Windows upgrade keeps a copy of any files that were not moved to the new version of Windows and were not identified as Windows system files. If you are sure that no user's personal files are missing after the upgrade, you can delete these files.";
  • Windows Upgrade Log Files : "Windows upgrade log files contain information that can help identify and troubleshoot problems that occur during Windows installation, upgrade or servicing. Deleting these files can make it difficult to troubleshoot installation issues.";
  • Windows ESD Installation Files : "You need these files do actualise or reset your computer." I suggest you to not delete these if you plan on refreshing Windows (Windows 8/8.1) in the future;

Here's an exemple of checkboxes/files that could come up in a Windows 7 installation.

- WARNING - PICTURE AHEAD -
delete-options-2.jpg
Credits to : http://www.thewindowsclub.com/automate-disk-cleanup-utility-windows

Other features of Cleanmgr.exe

When you select the "Cleanup system files" on Cleanmgr, on the new window, a new tab will appear, "More Options". This tab offers you two more features with two "Clean up..." buttons.

- WARNING - PICTURE AHEAD -
Q26SZFV.png

The first one explains you that you can clean up space on your drives by uninstalling programs, and if you click on it's "Cleanup..." button, it will open your list of installed programs (where you go to uninstall a program) if you ever want to uninstall programs from your system.

- WARNING - PICTURE AHEAD -
n0iCOHh.png

The second one explains you that you can gain back drive space by deleting the shadow copy of files (previous version of a file) and also old System Restore point. If you click on it's "Clean up..." button, a pop up box will appear saying that if you launch this action, all the Shadow Copy of your files will be deleted (but you'll recreate them when you use the documents again and if the Shadow Volume Copy service is enabled/started) and that all your System Restore points will be deleted except for the most recent one.

- WARNING - PICTURE AHEAD -
yidBG54.png

Create a secheduled task of a custom Cleanmgr

One good thing about Cleanmgr is that, because it's an in-built feature in Windows, you can easily create a scheduled task for it to be run whenever you want. BUT, that's not all. Cleanmgr allows you to create custom cleaning option when you call it with a special parameter. If you launch Cleanmgr with the /sageset parameter, it will allow you to create a Cleanmgr with custom clean-up settings that will be saved in the Registry. In other words, this will create a "shortcut" of a custom set Cleanmgr. You can have up to 255 different setup of cleanmgr. To create one, simply launch it by adding the /sageset parameter and add a number to it, IE : cleanmgr /sageset:1. The Cleanmgr window will open with every options available for your Windows version and all you have to do, is to check the ones you want Cleanmgr to take care of and click on Ok. Once done, this config will saved in the Registry and you'll be able to use it whenever you call Cleanmgr with the /sageset:1 parameter (if you want to remove it, you'll have to delete it from the registry). All you have to do now, is to add /sageset:1 (or the number you used for your own config) in the "Add arguments (optional)" textbox of the "Create Basic Task Wizard" when you create a scheduled task and when that Cleanmgr will be launched, it will take the settings that you set for /sageset:1. Simple as that !

The End!

That's it for that tutorial folks ! I hope you enjoyed it and that you learned more about the power Disk Cleanup (Cleanmgr.exe) in-built utility of Windows. If you have any questions concerning this tutorial or the Cleanmgr utility, feel free to post them in this thread or to send me a PM. I don't bite !

Have a good day !
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top