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<drive>:\] /sageset: <numeric between 0 and 65535>

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_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches registry subkey. To run the Disk Cleanup Wizard without user interaction, use the command

cleanmgr /sagerun: <numeric from 0 to 65535 defined by /sageset>

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.