How can I start the Windows 2000 Disk Cleanup Wizard from the command line?

John Savill

November 7, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. To start the GUI version of the Disk Cleanup Wizard, open a command prompt and type

cleanmgr

You can also create a configuration set to run the wizard without any user interaction at a future time. To create a configuration set, open a command prompt and type

cleanmgr [/d:] /sageset: 

The /d option specifies the drive you want the wizard to clean up. If you don't specify a drive, the wizard will act on all volumes. If the volume you specify isn't the system partition or volume, the wizard will check for space that it can recover by performing actions only on the Recycle Bin and content-indexer intermediary catalog files. The /sageset argument dictates which parameters appear in the dialog box in which you select the cleanup options that you want to perform. The different numeric values associated with the /sageset argument correspond to different sets of parameters. Make your selections in this dialog box, then click OK.

Click here to view image

Windows will save your configuration in the HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerVolumeCaches registry subkey. To run the Disk Cleanup Wizard without user interaction, use the command

cleanmgr /sagerun: 

The only visible indicator that the wizard is running will be a dialog box that shows the disk cleanup progress and gives the user the opportunity to cancel the task. However, the user can ignore this dialog box and the wizard will perform the cleanup without requiring user confirmation. You can define up to 65536 sets of parameters; however, I don't think that many combinations actually exist.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like