The Disk Cleanup Tool that comes bundled with Windows Operating Systems works just fine to free up some disk space. You can use it to remove Temporary Files, Service Pack Backup Files, and a myriad of other clutter that eventually builds up over time. You can even remove all but the most recent System Restore Point. Very handy, indeed.
But what if you have five, or ten, or more drives set up? Then it becomes a real pain in the neck because you have to select each drive one at a time, click Tools, then click Disk Cleanup… well, you get the idea. Drudgery.
Here’s a way to set up a simple batch file that will run the disk cleanup tool on all your drives. And with only one click! Don’t believe me? Watch this:
- Hold down the Windows Logo key and type the letter ‘R’
- In the window that opens, type ‘cmd’ and hit Enter
- In the Command Box that opens, type: cleanmgr /sageset:0
- At the tail end of that command, you can use any number from 0 to 255; this means you can set up 256 different Disk Cleanup operations, depending on your needs
- Now hit the Enter key and you’ll see a familiar-looking window:
- Now, go down the list and check all the items you want your Automated Disk Cleanup to remove
- Once you are happy with your selections, click on ‘OK’
- Almost done
- You can close the Command Box, too; we’re done with that
Now we are ready to write our little batch file:
- Open Notepad
- Type: cleanmgr /sagerun:0
- Be sure to use the same number that you used before; in this case, I used the number 0
- In the File Menu, choose ‘Save As’
- Give your file a descriptive name (like, ‘DiskCleanAll’) and be sure the extension is: .bat
- If you make a mistake somehow and the file saves with the ‘.txt‘ extension, just rename it
- You’re done!
Now you are equipped with a one-click solution to run Disk Cleanup on all your drives.
Run the .bat file and watch the magic!
Enjoy this article?