DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 253597 - Last Review: December 17, 2012 - Revision: 4.7

Hotfix Download Available
View and request hotfix downloads
 
This article was previously published under Q253597
Notice
This article applies to Windows 2000. Support for Windows 2000 ends on July 13, 2010. The Windows 2000 End-of-Support Solution Center (http://support.microsoft.com/win2000) is a starting point for planning your migration strategy from Windows 2000. For more information see the Microsoft Support Lifecycle Policy (http://support.microsoft.com/lifecycle/) .

On This Page

Summary

This article describes how to run the Disk Cleanup tool (Cleanmgr.exe) by using command-line switches. Cleanmgr.exe is designed to clear unnecessary files from your computer's hard disk. You can configure Cleanmgr.exe with command-line switches to clean up the files you want. You can then schedule the task to run at a specific time by using the Scheduled Tasks tool.

More information

You can start the Disk Cleanup tool by running Cleanmgr.exe, or by clicking Start, pointing to Programs, pointing to Accessories, pointing to System Tools, and then clicking Disk Cleanup. Disk Cleanup supports the following command-line switches:
  • /d driveletter: - This switch selects the drive that you want Disk Cleanup to clean. Note that the /d switch is not used with /sagerun:n.
  • /sageset:n - This switch displays the Disk Cleanup Settings dialog box and creates a registry key to store the settings you select. The n value is stored in the registry and allows you to specify different tasks for Disk Cleanup to run. The n value can be any integer value from 0 to 65535. To get all the available options when you are using the /sageset switch, you may need to specify the drive letter that contains the Windows installation.
  • /sagerun:n - This switch runs the specified tasks that are assigned to the n value by using the \sageset switch. All drives in the computer will be enumerated, and the selected profile will be run against each drive.

    For example, in Scheduled Tasks, you could run the following command after running the cleanmgr /sageset:11 command:
    cleanmgr /sagerun:11
    This command runs Disk Cleanup with the options that were specified with the cleanmgr /sageset:11 command.
The available options for Disk Cleanup that you can specify by using the /sageset and /sagerun switches include:
  • Temporary Setup Files - These files should no longer be needed. They were originally created by a Setup program that is no longer running.
  • Downloaded Program Files - Downloaded program files are ActiveX controls and Java programs that are downloaded automatically from the Internet when you view certain pages. They are temporarily stored in the Downloaded Program Files folder on your hard disk. This option includes a View Files button that allows you to see the files that would be removed. The button opens the C:\Winnt\Downloaded Program Files folder.
  • Temporary Internet Files - The Temporary Internet Files folder contains Web pages that are stored on your hard disk for quick viewing. Your personalized settings for Web pages are left intact. This option includes a View Files button that displays the files to be deleted. The button opens the C:\Documents and Settings\Username\Local Settings\Temporary Internet Files\Content.IE5 folder.
  • Old Chkdsk Files - When Chkdsk checks your disk for errors, it might save lost file fragments as files in your disk's root folder. These files are unnecessary and can be removed.
  • Recycle Bin - The Recycle Bin contains files you have deleted from your computer. These files are not permanently removed until you empty the Recycle Bin. This option includes a View Files button that opens the Recycle Bin.
  • Temporary Files - Programs sometimes store temporary information in a Temp folder. Before a program quits, it usually deletes this information. You can safely delete temporary files that have not been modified in over a week.
  • Temporary Offline Files - Temporary offline files are local copies of recently used network files that are automatically cached for you so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Offline Files - Temporary files are local copies of network files that you specifically made available offline so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Compress Old Files - Windows can compress files that you have not used in a while. Compressing the files saves disk space while still enabling you to use them. No files are deleted. Because files are compressed at different rates, the displayed amount of disk space you will gain is approximate. There is an Options button that you can use to specify the number of days to wait before an unused file is compressed.
  • Catalog Files for the Content Indexer - The Indexing service speeds up and improves file searches by maintaining an index of the files on the disk. These files are left over from a previous indexing operation and can be deleted safely.
If you select the drive that contains the Windows installation, all of these options are available on the Disk Cleanup tab. If you select any other drive, only the Recycle Bin and Catalog files for content index options are available on the Disk Cleanup tab.

The More Options tab contains options for cleaning up Windows components or installed programs. You can use the Windows Components option to create free space by removing optional Windows components that you do not use. Clicking the Clean Up button for this option starts the Windows Components Wizard. You can use the Installed Programs option to free more disk space by removing programs that you do not use. Clicking this Clean Up button starts the Change or Remove Programs option in the Add/Remove Programs tool.

Additional Information


For a Microsoft Windows XP version of this article, see 315246  (http://support.microsoft.com/kb/315246/EN-US/ ) .

Note: Disk Cleanup option on drive’s general properties and cleanmgr.exe is not present in Windows Server 2008 or Windows Server 2008 R2 by default. For more information on how to have Disk Cleanup button or cleanmgr.exe on Windows Server 2008 or Windows Server 2008 R2, visit the following Web site:

http://technet.microsoft.com/en-us/library/ff630161(v=ws.10).aspx (http://technet.microsoft.com/en-us/library/ff630161(v=ws.10).aspx)




Applies to
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows XP Professional x64 Edition
  • Microsoft Windows Server 2003 Service Pack 2
  • Microsoft Windows Server 2003 R2 Datacenter x64 Edition
  • Microsoft Windows Server 2003 R2 Datacenter x64 Edition with Service Pack 2
  • Microsoft Windows Server 2003 R2 Enterprise Edition (32-Bit x86)
  • Microsoft Windows Server 2003 R2 Enterprise x64 Edition
  • Microsoft Windows Server 2003 R2 Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003 R2 Standard x64 Edition
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems
  • Microsoft Windows Server 2003, Datacenter x64 Edition
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Windows Vista Business
  • Windows Vista Business 64-bit Edition
  • Windows Vista Enterprise
  • Windows Vista Enterprise 64-bit Edition
  • Windows Vista Home Basic
  • Windows Vista Home Basic 64-bit Edition
  • Windows Vista Home Premium
  • Windows Vista Home Premium 64-bit Edition
  • Windows Vista Service Pack 2
  • Windows Vista Ultimate
  • Windows Vista Ultimate 64-bit Edition
  • Windows Server 2008 Service Pack 2
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2008 R2 Datacenter without Hyper-V
  • Windows Server 2008 R2 Enterprise
  • Windows Server 2008 R2 Enterprise without Hyper-V
  • Windows Server 2008 R2 for Itanium-Based Systems
  • Windows Server 2008 R2 Standard
  • Windows Server 2008 R2 Standard without Hyper-V
  • Windows Server 2008 R2 Service Pack 1
  • Windows 7 Enterprise
  • Windows 7 Home Basic
  • Windows 7 Home Premium
  • Windows 7 Professional
  • Windows 7 Ultimate
  • Windows 7 Service Pack 1
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Datacenter without Hyper-V
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Enterprise without Hyper-V
  • Windows Server 2008 for Itanium-Based Systems
  • Windows Server 2008 Standard
  • Windows Server 2008 Standard without Hyper-V
Keywords: 
kbhotfixserver kbqfe kbinfo KB253597
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support