How can I schedule the Disk Cleanup wizard to run automatically in Windows XP/2003?

Your computer stores its data on hard disk(s). Disks can accumulate a lot of un-used files, old temporary files, temporary Internet files, old setup files and more. Keeping your disks clean and tidy is a task that can be done manually (by those of you who know what to delete – not any file can be manually and most important – safely – deleted without knowing what exactly your computer no longer needs), but since it tends to take a lot of time, it is best to schedule it to automatically run while you are asleep or away from your computer.
BTW, disk maintenance is also covered in the Schedule Disk Defragmenter to Run Automatically in Windows XP/2003 article.
Windows XP/2003 contain a nice GUI-based utility called the Disk Cleanup tool. It can be found by clicking Start > All Programs > Accessories > System Tools > Disk Cleanup.
You can run the tool by clicking it and manually following the prompts, but doing so requires that requires human intervention. Why not schedule it to run automatically?
In order to schedule the Disk Cleanup tool to automatically run perform the following steps:

  1. Click Start Menu > Run, then type cleanmgr /sageset:1
  2. Click OK.

Disk Cleanup opens with a list of the possible files to be deleted. Select a file type to display a description. Check the boxes for the files you want removed, and click OK.
disk cleanup 1 small
Next, you need to schedule Disk Cleanup to run when you want it to.

  1. Open Control Panel, double-click Scheduled Tasks
  2. Double-click Add Scheduled Task

dfrg sch 1 small

  1. On the Scheduled Task Wizard dialog, click Next.

dfrg sch 2 small

  1. In the list of applications you want Windows to run, click Disk Cleanup, and then click Next.

dsk clnp sch 1 small

  1. Select a frequency for the task (once per week is usually enough) and click Next.

dsk clnp sch 2 small

  1. Select a day of the week and time for the task to run.

dsk clnp sch 3 small

  1. Enter the name and password of a user.

dfrg sch 6 small1

  1. Check the box to open Advanced Settings when you’re done.

dfrg sch 7 small1

  1. In the Run box, add the following to the end of the path: /sagerun: 1 and then click OK.

dsk clnp sch 4 small

  1. Task Scheduler will automatically run Disk Cleanup with the settings you selected at the time you selected.


Further Reading

You may find these related articles of interest to you: