Author Topic: Use Some (Relatively) Unknown Command-Line Switches for Disk Cleanup  (Read 3051 times)

0 Members and 1 Guest are viewing this topic.

Offline Nick

  • Administrator
  • Platinum Member
  • *
  • Posts: 46028
  • Karma: +1000/-0
  • Gender: Male
  • NickCS
    • http://www.facebook.com/nickcomputerservices
    • http://www.twitter.com/nickcomputer
    • Computer Chiangmai

Use Some (Relatively) Unknown Command-Line Switches for Disk Cleanup

Learn about two cool command-line switches for Disk Cleanup that are relatively undocumented.


Disk Cleanup offers some cool command-line switches that are documented only in a pair of obscure Knowledge Base articles. Through the use of these switches, you can save your preferences and rerun the cleanup process automatically using those settings. To do so, you need to use the following switches with Cleanmgr.exe:

/Sageset:n Opens a dialog box that allows you to select Disk Cleanup options, creates a registry key that corresponds to the number you entered, and then saves your settings in that key. Enter a number from 0 through 65535 in place of n.

/Sagerun:n Retrieves the saved settings for the number you enter in place of n and then runs Disk Cleanup without requiring any interaction on your part.

To use these switches, follow these steps:

1. Open a Command Prompt window and type the command cleanmgr /sageset:200. (The number after the colon is completely arbitrary; you can choose any other number from 0 through 65535.) Note that you must supply credentials from a member of the Administrators group to begin this task.

2. In the Disk Cleanup Settings dialog box, choose the options you want to apply whenever you use these settings.

3. Click OK to save your changes in the registry.

4. Open Task Scheduler from Control Panel, and start the Create Basic Task wizard. Follow the wizard’s prompts to name the task, and schedule it to run at regular intervals. When prompted to select the program you want Windows to run, type cleanmgr.exe in the Program/Script box and type /sagerun:200 in the Add Arguments box.

5. Repeat steps 1–4 for other Disk Cleanup options that you want to automate.

From the Microsoft Press book Windows Server 2008 Administrator’s Pocket Consultant, Second Edition by William R. Stanek.

credit: technet.microsoft.com


 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)


Related Topics

  Subject / Started by Replies Last post
0 Replies
3876 Views
Last post February 16, 2009, 06:37:12 PM
by Webmaster
0 Replies
3426 Views
Last post February 16, 2009, 06:56:00 PM
by Webmaster
0 Replies
3598 Views
Last post June 11, 2010, 06:31:21 PM
by Nick
0 Replies
3855 Views
Last post June 11, 2010, 07:07:10 PM
by Nick
0 Replies
7706 Views
Last post June 16, 2010, 01:47:32 PM
by Nick
0 Replies
2962 Views
Last post June 16, 2010, 06:01:54 PM
by Nick
0 Replies
3494 Views
Last post June 16, 2010, 07:14:52 PM
by Nick
0 Replies
3030 Views
Last post June 16, 2010, 09:19:44 PM
by Nick
0 Replies
3352 Views
Last post July 02, 2010, 03:00:20 PM
by Nick
0 Replies
13292 Views
Last post July 03, 2010, 02:57:44 PM
by Nick