Friday, June 11, 2010

Unknown and useful Command Line Switches for Disk Cleanup

You have been using the Disk Cleanup feature for years. However, most of us are unaware of some cool features. This Disk Cleanup brings some cool command-line switches that are documented only in the pair ambiguous Knowledge Base articles. In this case, it is possible to save your preferences using the following switches and rerun the cleanup process automatically using those settings. If you’re ready to use, follow the following switches with Cleanmgr.exe:

/Sageset:n It is able to open a dialog box that lets you select Disk Cleanup options and creates a registry key according to the number you’ve entered. Then it saves the settings in that Key. You have to enter a number from 0 through 65535 in place of n.

/Sagerun:n It is able to retrieve the saved settings for the number you enter in the place of “n” and run Disk Cleanup without requiring any interaction on your part.

If you want to use these switches, follow these steps:

1.    First, open the Command Prompt window and then type the following command cleanmgr /sageset:555. Here, the number given after the colon is completely random. Therefore, you can choose any other number 0 through 65535. When you perform the step, the main thing you’ve to remember is you should have the administrative privileges.

2.    Then, you have to choose the options from the Disk Cleanup Settings dialog box to apply whenever you use these settings.
3.    Now, click on OK to save your changes in the registry.
4.    Then, open the Task Scheduler from the Control Panel and start the Create Task Wizard.
5.    After that, it is required to follow the onscreen instructions to name the task and schedule it to run at regular intervals.
6.    If you’re prompted to select the program you want Windows to run, type cleanmgr.exe in the Program/Script box and type /sagerun:555 in the Add Arguments box.
7.    That’s it. Now, you can follow the same procedure for other Disk Cleanup options that you want to automate.

By