• Is 65535 a “special” setting for Cleanmgr.exe?

    Home » Forums » Is 65535 a “special” setting for Cleanmgr.exe?

    Author
    Topic
    #489819

    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:WindowsSystem32Cleanmgr.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:WindowsSystem32Cleanmgr.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.

    Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
    We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
    We were all once "Average Users".

    Viewing 2 reply threads
    Author
    Replies
    • #1398407

      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

      Plethora means a lot to me.

    • #1398498

      Similarly, the maximum pagefile size for 32bit Widows is 4095, or 212 -1.

      Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
      We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
      We were all once "Average Users".

    • #1398524

      There are many of these ‘magic numbers’ about, which shows why computer people should work in binary not decimal!

      BATcher

      Plethora means a lot to me.

    Viewing 2 reply threads
    Reply To: Is 65535 a “special” setting for Cleanmgr.exe?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: