Results 1 to 4 of 4
  1. #1
    Super Moderator bbearren's Avatar
    Join Date
    Dec 2009
    Location
    Polk County, Florida
    Posts
    3,760
    Thanks
    26
    Thanked 424 Times in 338 Posts

    Is 65535 a "special" setting for Cleanmgr.exe?

    The two most commonly used switches for cleanmgr are /sageset:n and /sagerun:n. The only thing special about the number 65535 is that it is the largest "n" for the switch; 65536 won't work. Any number from 1 to 65535 can be used.

    If one runs cleanmgr /sageset:n (choose your own number) in a Command Prompt, the Disk Cleanup utility opens with some of the options selected. One may choose all or just one. And that's where the "n" comes in. Different sageset numbers can be used to stage varying levels of cleanup through selecting various options, then clicking OK. Those various stages of disk cleanup can then be implemented running cleanmgr with the sagerun switch and the corresponding sageset number.

    One can use a shortcut invoking C:\Windows\System32\Cleanmgr.exe /sagerun:n (where n is your number of choice from 1 to 65535 corresponding to the "n" used with the sageset switch) for whatever level of disk cleanup has been selected for that particular number, and another shortcut using the "n" for a different level of disk cleanup determined by the sagerun switch using that different "n". Using the extended Cleanmgr in this way allows it to run on all volumes. If one wishes to select volumes, there is also a /d switch; for example /d D.

    My personal preference is to select all options using sageset:1 and without the /d switch.

    Next I open Task Scheduler using "Run as administrator", highlight "Task Scheduler Library" in the left pane, then click "Create Task" in the right pane. Under the "General" tab, I name the task "Disk Cleanup". Under the "Triggers" tab I set a daily time (I use 11:00 PM, since my desktop runs 24/7).

    For "Actions" I use "Start a program" and browse to C:\Windows\System32\Cleanmgr.exe and select it, then in "Add arguments (optional):" textbox I type /sagerun:1. Under the "Conditions" tab I leave the defaults checked, and under the "Settings" tab I make sure there is a check by "Allow task to run on demand", then OK everything and close Task Scheduler.

    This works for Windows XP, Windows 2000 Professional, Windows Vista, Windows 7, and Windows 8. It also works on Windows 98, as I recall. I'll have to check that in my VM on my laptop next time I use it.

    Create a fresh drive image before making system changes, in case you need to start over!

    "The problem is not the problem. The problem is your attitude about the problem. Savvy?"—Captain Jack Sparrow "When you're troubleshooting, start with the simple and proceed to the complex."—M.O. Johns "Experience is what you get when you're looking for something else."—Sir Thomas Robert Deware.
    Unleash Windows

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    You will surely remember from grade school that 65535 is (2^16)-1, so they are using a 16-bit, 2-byte field, encoding numbers from 0 to 65535, often expressed as 0x0 to 0xFFFF.

    End of maths lesson!
    BATcher

    Time prevents everything happening all at once...

  3. #3
    Super Moderator bbearren's Avatar
    Join Date
    Dec 2009
    Location
    Polk County, Florida
    Posts
    3,760
    Thanks
    26
    Thanked 424 Times in 338 Posts
    Similarly, the maximum pagefile size for 32bit Widows is 4095, or 212 -1.
    Create a fresh drive image before making system changes, in case you need to start over!

    "The problem is not the problem. The problem is your attitude about the problem. Savvy?"—Captain Jack Sparrow "When you're troubleshooting, start with the simple and proceed to the complex."—M.O. Johns "Experience is what you get when you're looking for something else."—Sir Thomas Robert Deware.
    Unleash Windows

  4. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    There are many of these 'magic numbers' about, which shows why computer people should work in binary not decimal!
    BATcher

    Time prevents everything happening all at once...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •