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.