| Learning About Computers and the Internet | |||||||
|
|
|
The Windows operating system tends to build up temporary files over time. Managing these files with the system tool Disk Cleanup is discussed.
Regular Windows system maintenance should include the removal of unnecessary temporary files that the system accumulates. This computer housekeeping task is discussed in general on another page but here I will detail how to use the tool called Disk Cleanup that is included with the Windows operating system. Although it has some limitations discussed in another section below, Disk Cleanup may be sufficient for many home PC users to help keep their system clean. The tool can be accessed in several ways . Scripting Disk CleanupMore experienced PC users may be interested in the scripting possibilities that are possible when Disk Cleanup is invoked directly with the command "cleanmgr.exe". There are some switches that can be used as shown in the table below.
Here are some possible ways to use the switches. To clean a specific drive F:, enter into Start-Run or a command prompt the command: To create a Registry key with specific settings to be used in a subsequent operation of Disk Cleanup enter: These commands can be used in scripts for manual or automated use. For some additional discussion see this Microsoft reference Automating Disk CleanupOnce options have been set up by creating one or more Registry keys, the Disk Cleanup utility can be scheduled to run at regular times. Many PC users may find that an automated procedure is a relatively painless way to do some housekeeping chores. Automation using Task Scheduler is described at this reference from Ramesh Srinivasan. Limitations of Disk CleanupSystems with the file system NTFS often experience a long delay during disk cleanup because the default behavior is for Windows to check to see if it should apply file compression to old files. Systems may even stop responding. The solution is to edit the Registry as described in this Microsoft article. Open Regedit and delete this key: Another quirk of Disk Cleanup is that it may leave a lot of temporary files untouched. It is designed to remove only files that are over a week old. Also, as mentioned above, it only cleans %TEMP% but other temp folders can be added as described in the next section. Also, a more thorough cleaning can be obtained by opening a Temp folder, selecting all files and sub-folders, and deleting. Note that any temporary files currently in use by the system will be locked and cannot be deleted. In fact, the presence of locked files will cause the process of deletion to stop. Additional methods of cleaning are discussed here. Adding Features to Disk CleanupOther folders can be added to those that are cleaned up in the normal setup by doing a Registry edit. I think it is worthwhile to add the \Windows\Temp folder and I have posted a REG file that does this. It can be downloaded at this link. Another change to be considered is to shorten the time from the default seven days that temp files are kept before they can be deleted. Again a Registry edit is required. To change the time files are kept in %TEMP%, go to the Registry key: As always, do not edit the Registry unless you back it up first. Disk cleanup in Windows Vista and Windows 7The general features of Disk Cleanup are similar in Windows Vista and Windows 7 but some details are different. Using the tool in the newer operating systems is discussed on another page. Additional referencesMore information on Disk Cleanup is in this Microsoft article and at the Elder Geek. |
| << Home page | ©2002-2013 Victor Laurie | Home page >> |