Disk space cleanup is a critical must these days with a lot of people opting for a Solid State Drive (SSD) in their computers. SSD drives speed up the computer significantly but the downside is that they tend to be smaller capacity drives, especially if you go for the cheaper options like this Kingston 120GB SSD for less than £20 (GBP) from Amazon.
So, you will want to save space where you can, so here we will show you how to use disk space cleanup methods. There are a few options available to you depending on your setup and what you are willing to use and not use.
- Disk Space Cleanup Utility
- Disk Space Cleanup
- Windows Update Cache
- Clean Thumbnail Database
- Installer Folder
- Windows Error Reporting Files (WER)
Disk Space Cleanup Utility
Before we delve into the technical side of how to run the various elements of what a disk space cleanup takes, we would like to let you know about our free, simple to use tool that carries out all the below options automatically with just one double click!
Our Disk Space Cleanup Utility is basically a Windows batch file that runs through all the commands that are listed below. This means that you can download it, run the .bat file as an administrator and sit back whilst it does the work.
Disk Space Cleanup Utility Video Demo
You can see the disk space saver utility in action by checking out of demo video below:
Full information and instructions on this utility can be here and you can download using the button below:
First of all you have the option of turning off the hibernation feature. This feature takes up a lot of disk space as it uses it to store the current activity of your working session. So, if you can do without that, you can turn it off and this will remove the large hiberfil.sys file from your disk and save you space.
To turn off hibernation, right click on your Windows 10 Start Button and select “Command Prompt (Admin)” to bring up a command prompt which has been elevated to an administrator level. Then type in the following command to disable the hibernation on your machine:
powercfg /h off
You will need to then reboot your machine to complete the removal of the hiberfil.sys file from your machine.
If you are using a desktop computer with a SSD as your primary but also have a larger capacity SATA hard drive as a secondary disk, then you can move the pagefile.sys from the root of your C: drive to the secondary larger capacity disk. The pagefile size is dependent on the amount of RAM you have in your machine, so the more RAM you have, the more space the pagefile.sys will take up on your disk.
So, to move the pagefile.sys, carry out the following steps:
Right click on your Windows 10 Start Button and select “System“. This will bring up a box and you will then need to click on “Advanced System Settings” on the left hand side:
This will take you directly into the “Advanced” tab and you should then click on the “Settings” button under Performance:
This will take you in to the “Performance Options” and you should then click on the “Advanced” tab and then click on the “Change” button under the “Virtual memory” section:
You will then see that the default setting is that the “Automatically manage paging file size for all drives” is ticked. You should now untick this box which will allow you to make changes.
Click on the drive that you want to move your pagefile.sys to and then click the “System managed size” radio button. Then click on the “Set” button. You should then click on the drive where your pagefile.sys was originally and click the “No paging file” radio button and click the “Set” button. So your virtual memory should now look something like this:
You should now reboot your machine for the changes to take affect.
Disk Space Cleanup
You can run the built-in Disk Cleanup option in Windows 10 allowing you to clean up a significant amount of space like temp files and cache internet files. To do this, left-click your Windows 10 Start button and then type “Disk Cleanup“. You should see it appear in your Start Menu. Left-click it to start the application.
To start with, you will see a wizard where you can select which drive you want to run disk cleanup on:
Make your selection from the drop-down list and click the “OK” button.
This will now start the process of searching for files that it can clean up from your machine. Once complete, you should see something like this:
However, instead of proceeding from here, you should now go ahead and click on the “Clean up system files” button. This will run the search again and bring back a large number of selections that you can clean up on your disk. This will take a little longer to run through it’s search.
Once this is complete, you can go through the “Files to delete” selection and then click the “OK” button. This will then run through all the files as requested and clean them up. You should notice an immediate difference in your available disk space.
If you want to run a clean up on your temp files using a command line, then you can run this in a command prompt:
del c:\windows\temp\*.* /s /f /q
Windows Update Cache
Once you have tried all the above methods, you should have a significant amount of space now available. However, if you still need to free up more space. There are some more advanced options available to you.
One of them is to completely clear your Windows Updates Cache and database. Although not recommended, if you are desperate, you can go ahead and try this.
First of all, you need to stop the Windows Update service from running to allow you to make changes to the core files. So, go ahead and open up an elevated command prompt. To do this, right-click on the Windows 10 Start button and select “Command Prompt (admin)“. In the command prompt window type the following command to stop the Windows Update service:
net stop "windows update"
This will stop the Windows Update service and you should get an output like this:
If you get a message stating that the service is not running, that’s fine and you can carry on to the next step.
You should now browse to the following location which is where the Windows Updates Cache is stored:
You can go ahead and delete all of the folders and files in this location.
You should then go to this location which is where the Windows Update database is stored:
You should go ahead and delete all folders and files in this location.
Once this has completed, reboot your machine and the Windows Update service will go back into the state it wants to run in. Next time you run Windows Updates, it will recreate a smaller database and then start to store files for the available updates from that point. So you can run through this process again later if you start to get low on space again.
Command Line Method
If you want to clear out your Microsoft Updates cache folder using a command line, then you can use this set of commands:
net stop "Windows Update" del /q "C:\Windows\SoftwareDistribution\*" FOR /D %%p IN ("C:\Windows\SoftwareDistribution\*.*") DO rmdir "%%p" /s /q net start "Windows Update"
The WinSXS folder can get extremely large. It is also a very important folder for Windows and other programs to work with future updates or uninstalls. In a simple way of looking at it, it is the source files for everything you install on your machine including software, drivers and updates. However, you can clean it up using the built-in DISM program with Windows 10.
Note that this process really should be your last resort so do not blame us if you screw your machine up!
So, you really are desperate for some more free space if you have gotten this far in the guide so this is what you can do.
Open up an elevated command prompt. To do this, right-click on the Windows 10 Start button and select “Command Prompt (admin)“. Then you can use these three commands to try and clean up any orphaned or unused files in your WinSXS folder:
Start with the /AnalyzeComponentStore parameter – this analyses the “store” of core files and is the important first step:
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Once this step has completed, it should show you some information on what disk space it has freed up:
Note that on my screenshot I only have one component that has been freed up as I have already run this command on my machine not long ago.
It would be interesting to see what results you get from running this command. Please feel free to leave us your results in our comments section at the end of this page!
Using the /StartComponentCleanup parameter deletes previous versions of updated components (without a 30 day grace period) and you will not have a 1-hour timeout limitation.
Dism.exe /online /Cleanup-Image /StartComponentCleanup
This will then go through and cleanup the components that it can. This will take a little longer than the other commands and may look like it gets stuck at 10% – but do not exit or close the command prompt, it will complete eventually and you will get a notice like this:
Using the /ResetBase switch with the /StartComponentCleanup parameter of DISM.exe removes all superseded versions of every component in the component store.
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
This should not take more than a few seconds to complete and you will see a completion notice like this:
To reduce the amount of space used by a Service Pack, use the /SPSuperseded parameter of Dism.exe to remove any backup components needed for uninstallation of the service pack.
Dism.exe /online /Cleanup-Image /SPSuperseded
In most cases, this command will not actually do anything as most installations will not have Service Pack installation files hanging around, but always best to run it just in case.
If there are Service Packs to cleanup, these processes can take a long time to run, depending on the spec of your machine, it could run into hours.
Clean Thumbnail Database
There is also an area on your local disk that stores thumbnail databases and these can also become large. Clean these up by running the following commands in an elevated command prompt:
attrib -r -s -h "%userprofile%\AppData\Local\*.db" attrib -r -s -h "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.db" del "%userprofile%\AppData\Local\*.db" del "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*.db" explorer
If you are using it, you can clear your computers Branchcache. 99% of people will not be aware of this and there is scope for saving quite a lot of disk space here.
Check the Branchcache Status
Just to make sure that you are not going to ruin your computer, it is best to just check the status of your branchcache first. To do this, follow the steps below:
Elevated Command Prompt
To carry out all of these steps, you will need to have an elevated Windows Command Prompt to use. To do this you can see this quick YouTube video below:
Open an elevated Command Prompt within Windows, then type in the following command:
netsh branchcache show status all
This will return a lot of information, but what you are actually looking for is the Current Status as you can see in the below snapshot:
As you can see from the above, my machine states “This machine is not configured as a hosted cache client.” – this means that I can go ahead and clear my branchcache.
To do this, just run this following command:
netsh branchcache flush
This will now go off and clear the branchcache and you should get a return to say it has been successful:
This will now have cleared some space for you on your computer.
If you speak to any IT guy, they will tell you that the C:\Windows\Installer folder is a nightmare for using up disk space.
It is one of those folders that you cannot delete without screwing up your machine, but just keeps getting bigger and bigger and bigger.
So, what can we do with this folder to space disk space if we can’t delete it?
You can compress the data files within the folder. This means that you can save around 50% of size of the Installer folder.
To do this, you need to go directly to this location using your File Explorer:
You cannot browse to this location as it is a hidden Windows folder, so type it in the address bar and hit enter.
This will take you into a folder with what may look like a load of strange files and will look something like this:
Select one of the folders and then on your keyboard, press CTRL+A to select them all. Then with your mouse, right-click and then click on Properties:
A properties box will pop up and you will then need to click on the Advanced button:
You should then tick the Compress contents to save disk space option and click OK:
This will now ask you if you want to confirm the attribute changes:
Click OK and you may get an error box pop up about admin rights:
Just go ahead and click the Continue button on that error.
This will now go through all the folders and files and compress them where it can – saving your more disk space!
Command Line Method
You can run the above by using a simple command-line which is probably easier and quicker than doing it through Windows.
Just open up an elevated command prompt and run the following command:
compact /c c:\windows\installer\*.*
Windows Error Reporting Files (WER)
One of the final places you can retain some disk space from is the error event logs on your machine. These are all the logs that get recorded as you use your machine and can get very large after a while.
First of all, check you are happy to clear out all your event logs and then run these commands from an elevated command prompt:
forfiles -p "C:\ProgramData\Microsoft\Windows\WER\ReportArchive" -d -90 -c "cmd /c del @PATH" /q forfiles -p "C:\ProgramData\Microsoft\Windows\WER\ReportQueue" -d -90 -c "cmd /c del @PATH" /q
Hopefully, this guide has helped you in clearing some disk space on your machine and if it has we would love to hear your feedback and let us know how much space you have saved – winner gets a mention on our social media! Just go ahead and leave us a comment below.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?