Automatically free up hard drive space with the Disk Cleanup tool on Windows 10
Instead of manually trying to remove unnecessary files from your computer to free up disk space, use the Disk Cleanup tool on Windows 10 to automate the process. Here's how!

Disk Cleanup is a maintenance tool that has been part of Windows for a long time, and it allows you to reclaim hard drive space to make room for more of your valuable content. With it you can quickly find and get rid of temporary and system files, such as previous Windows installation files and updates, which otherwise would be nearly impossible for regular users to find and remove — and those files might be taking up gigabytes worth of space!
However, even on Windows 10, Disk Cleanup remains a tool that you have to run manually. What you probably may not know is that you can configure the tool to run automatically to delete certain files from your computer.
In this Windows 10 guide, we'll walk you through the process to configure the Disk Cleanup tool and use the Task Scheduler to remove unnecessary files from your computer making space for new content.
How to automate Disk Cleanup on your PC
- Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
- Type the following command and press Enter:
cleanmgr /sageset:11
In this command, we're using the switch /sagest:n to open the Disk Cleanup settings and at the same time create a registry key that will store the settings you choose. The n number, which is also stored in the registry, indicates the settings you want to use with the tool.The number can be anything from 0 to 65535, and it's basically like a filename that points to all the specific settings you want to use. This way, you can set different numbers to run the tool with different settings at different times.
- Once the Disk Cleanup Settings opens, check the items you want the tool to remove automatically from your system from the extensive list. Some of the files you can clean up include:
- Windows Update Cleanup
- Downloaded Program Files
- Temporary Internet Files
- Temporary files
- System error memory dump files
- Files discarded by Windows upgrade
- Windows ESD installation files
- Previous Windows installations
- Recycle Bin
- Temporary Windows installation files
- Click the OK button to save and store the settings in the registry.
- Open Start, do a search for Task Scheduler and click the result to open the utility.
- Right-click Task Scheduler Library, click New Folder and name the folder something descriptive like User Defined Tasks.
- Right-click the newly created folder and click Create Basic Task.
- Name the task, add a description you like, and click Next.
- Select when you want the task to run and click Next. These options are very flexible as you can set different times, in addition to set specific events to trigger the task. For the purpose of this guide, we'll be choosing Monthly.
- Select the date and time, and click Next.
- On Action, select Start a program and click Next.
- Type the path to open the Disk Cleanup tool: C:\Windows\system32\cleanmgr.exe and include the argument /sagerun:11. (Remember to change the number 11 to the number you that you chose in step 2 to use the settings you have configured.)
- Click Next.
- On the Summary page, click Finish to complete the task.
After completing the task, the Disk Cleanup tool will run at the time you specified, deleting all unnecessary files from your computer. If for any reason, you need to change the current settings for the task, open the Task Scheduler, open the folder you created, double-click task, and update the configuration.
How to run Disk Cleanup out of its schedule
You can use the following steps, in the case, you want to run Disk Cleanup before the specified schedule:
- Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
- Type the following command and press Enter:
C:\Windows\system32\cleanmgr.exe /sagerun:11
Remember to change 11 to the number you have chosen. After running the command, the Disk Cleanup tool will open and run immediately, removing all the files you have configured on the tool.
How to modify Disk Cleanup settings
If you want to add or remove items you want Disk Cleanup to delete automatically, then use these steps:
- Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
- Type the following command and press Enter:
cleanmgr /sageset:11
Remember to change 11 to the number you have chosen to store the settings. - As you execute the previous command, you will notice that the Disk Cleanup tool will open with all the settings you have previously configured. Now simply modify the list by checking the new items and removing the ones you don't want.
- Click OK to complete the task.
Disk Cleanup is a great tool that continues to come included with Windows 10, and it can help you to reclaim space on your hard drive. In the latest version of the operating system, it's also a great way for users in the Windows Insider Program to check periodically and delete previous installations of the operating system, which are known to take up several gigabytes after a new build of Windows 10 is installed.
Important: Deleting previous installation files will prevent you from rolling back to the previous version of the operating system.
Furthermore, you can also use this technique to help family and friends to keep their computers free of clutter by automating Disk Cleanup to remove unnecessary files, such as those in the Recycle Bin, common temporary files, old Windows updates, and other files.
Finally, remember that even though we're focusing these steps for Windows 10 PCs, you can also use the same concept to clean up files and reclaim space on Windows 8.1, Windows 7, and other versions of the operating system.
Do you usually remember to clean up unnecessary files from your Windows 10 PC? What kind of utility do you use? Tell us in the comments below.
More Windows 10 resources
For more help articles, coverage, and answers on Windows 10, you can visit the following resources:
- Windows 10 on Windows Central – All you need to know
- Windows 10 help, tips, and tricks
- Windows 10 forums on Windows Central
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.
-
Or you can simply go into your drive's properties on and off and do a disk cleanup
-
Probably you will do it when it is too full, and sometimes too late. The point is to do it automatically every time and you don't have to be bothered and don't even need to think about it again. Only set it up once.
-
Before I read this, I ran disk cleanup daily! It isn't just a disk space issue. windows tends to hang, freeze, or slow waaaay down if your temporary internet files & other "junk" are not cleared out on a regular basis. At work i have to run it every time the computer starts up or after awhile the computer will hang completely, which is not good when your on a call with someone & there in a hurry as it is. i've also tested this theory at home. my computer never freezes or hangs, but my wife's computer freezes at least once a week. same at work my coworkers their computers are forever freezing on them. part of that is not all of them shut their computers off at the end of the workday, but a few do & there's still hang. but mine never does. almost never anyway, & only thing i do different is run disk cleanup daily so
-
Not really, this gives you more options. Been doing it for a long time myself.
-
Great tip.
-
Interesting you can run it automatically. A must-run tool if you are an insider since Windows keeps the old installation files after each new build which is like 20GB
-
I've needed to do this so many times... thanks! Posted via the Windows Central App for Android... I'm sorry
-
That's neat. Thanks.
-
Great tip! Nice!
-
Mauro Is Life!
-
Useful. Thank you!
-
I have been doing this manually since so long ago, never knew there was an automatic command, thanks for the article, im so going to run this weekly. Since tablet pc's have less dpace and we need to constantly maintain the space. Thanks again.
-
I also like PatchCleaner (http://www.homedev.com.au/Free/PatchCleaner) for cleaning out old Update installation files. Gives you the option to Delete or Move the files, so the risk is mitigated. I run it after every update cycle to keep things tidy.