Windows systems and programs create and use a lot of temporary files. Unfortunately, Windows is not always a good housekeeper and lets these “temporary” files accumulate. You might be surprised at how much stuff your system picks up over time. Some PC users may prefer to use a program like CCleaner to keep things neat but there is something to be said for keeping the system simple and using the built-in Windows accessory Disk Cleanup.
Windows Disk Cleanup of temporary files can be improved with a configuration change. A previous tip showed how to speed up Disk Cleanup in Windows XP and this tip will show how to make Disk Cleanup more thorough in all versions of Windows.
By default, Disk Cleanup only erases temporary files that are older than 7 days. If you do not want files left behind for that long, this setting can be changed to a shorter time with a Registry edit. (Before doing any Registry editing, be sure you understand what is involved. For example, see this tutorial.)
Editing the Registry to reduce time temp files are kept
Open the Registry editor and go the key:
- In the right pane, right-click the entry “LastAccess”
- Choose “Modify”
- A dialog box similar to the figure below will open
- Enter a new value, such as 2, which will set the number of days that temp files are kept
- Click “OK”
- New value will take effect after a reboot
Registry file for painless Registry editing
If editing the Registry manually does not appeal to you, I have uploaded a Registry file that will do the job for you. Go to this page to download a zipped REG file. This particular file will reduce the time that temp files are kept to two days. It can be used for Windows XP/Vista/7. Be sure to back up your Registry before applying any changes.
More information about Disk Cleanup
Using the command line
The command line can be also used for a quick cleanup of temp files. See the following companion tip.
Get your own favorite tip published! Know a neat tech tip or trick? Then why not have it published here and receive full credit? Click here to tell us your tip.