Windows Disk Cleanup is a task that should be performed periodically to eliminate clutter. You may occasionally remember to run this program, but how often do you really do it. Did you know it can be scheduled?
Without too much hassle Disk Cleanup can be scheduled with Windows Scheduler, but it will only load, calculate how much space can be freed, and wait for user input. And a scheduled program that loads and waits for input isn't much help. But wait! There's more!
Did you know you can establish a set of rules that tells Disk Cleanup what you want cleaned and that it can be scheduled to run automatically without any user input? It's true.
I'll show you how it's done, but you might first want to have a look at the knowledge base article on this subject.
Got that? I thought so. Here's how it's done:
Establish the Rules
The first thing we're going to do is tell Disk Cleanup what to do when it runs.
1. Click Start, Run and type in the following to clean the C: drive:
cleanmgr /d c: /sageset:xxxxx
[Substitute xxxxx for any number from 0 to 65535]
Example:
cleanmgr /d c: /sageset:11
A Disk Cleanup Settings dialog box similar to the one below will be displayed.
![]() |
2. Work your way down the list and check the types of files you want deleted. When you're done click okay.
3. Test your settings by running Disk Cleanup using the Run … command:
cleanmgr /sagerun:xxxxx
[Substitute xxxxx for the number you used in /sageset:]
Example:
cleanmgr /sagerun:11
Review: Disk Cleanup Parameters
Here's what we've learned so far.
a. You can run the Disk Cleanup program by clicking on Start, Run… .
b. You can establish a set of rules using the /sageset:xxxxx parameter.
c. The xxxxx can be any number between 0 and 65535.
d. You can specify what drive will be checked using the /d drive letter: option.
e. If you don't specify the drive letter option Disk Cleanup will be run on all the computer's drives.
f. You don't need to specify the drive letter with the /sagerun parameter because it was already specified with /sageset.
g. When you run Disk Cleanup with the /sagerun:xxxxx parameter you must use a number previously set with the /sageset:xxxxx parameter
h. You can establish 65,536 sets of Disk Cleanup rules on one computer. Far more than we actually need.
Scheduling the Task
Now that you're satisfied with the results of an automated Disk Cleanup you can set up the Scheduled Task to run weekly.
1. Go to the Control Panel and open Scheduled Tasks.
2. Double-click Add Scheduled Task to begin the Scheduled Task Wizard. Click Next to continue.
3. Scroll down the list until you see Disk Cleanup. Select it and click Next.
4. Name the Task or leave it as is and click on the radio button next to Weekly. Click Next to continue.
5. Select the time of day and the day(s) of the week you want this task to run. When you're done here click Next to continue.
6. Enter and confirm the password you have set for yourself on this computer. Click Next to continue.
7. Check the box to open advanced properties and click Finish. This will open the property sheet for the task. Note: If you forget to open the advanced properties at this point just locate the task in your task list, right-click and select Properties.
8. In the Run: text box you will see the command to run Disk Cleanup. Type in the /sagerun:xxxxx at the end of the command leaving a space between the end of the command and the /sagerun parameter. Substitute xxxxx with the number you used earlier when setting the Disk Cleanup rules.
Example:
C:\WINDOWS\system32\cleanmgr.exe
Becomes:
C:\WINDOWS\system32\cleanmgr.exe /sagerun:11
9. Ensure that Enabled is checked. Otherwise the Task won't run as scheduled.
10. Click the Settings tab.
11. Check the Wake the computer to run this task checkbox to ensure the computer will come out of standby when it 's time to run this task.
That's it; we're done. You can check the results by returning to Scheduled Tasks and checking the dates and run times in the Next Run Time and Last Run Time columns.

No comments:
Post a Comment