Automate Disk Cleanup using Task Scheduler in Windows XP
Configure the tasks
Type cleanmgr /d c: /sageset:100 in the RUN box. The Disk Cleanup dialog box appears. Check the items you want to clean every time you run this process, for example Recycle Bin, Temporary Internet Files, Old Chkdsk files and then click on OK.
/d driveletter: - This switch selects the drive that you want Disk Cleanup to clean. Note that the /d switch is not used with /sagerun:n.
Create a new shortcut in your Windows folder using cleanmgr /sagerun:100 as the command line. Name it as CleanupTask.
Using the Task Scheduler
- Open Scheduled Tasks from Start Menu, Accessories, System Tools.
- Double-click Add Scheduled Task
- Choose Next
- Click on Browse and locate the shortcut file that you just created [CleanupTask]
- Choose Weekly and click Next
- Select the Time and day during which you want the CleanupTask to run.
- Click Next
- Type-in the Username and password. [By default, task scheduler won't run with blank password]
- Choose Next, Finish
NOTE: sageset:n - option displays the Disk Cleanup Settings dialog box and also creates a registry key to store the settings that you select. The n value, which is stored in the registry, allows you to specify tasks for Disk Cleanup to run. The n value can be any integer value from 0 to 65535. To have all of the options available when you use the /sageset option, you might need to specify the drive where Windows is installed. You can have any number of tasks created [in Sageset 1, you can select "Recycle Bin", in Sageset configuration 2, you can deselect Recycle-bin. Each of the Sageset configurations are stored in the following registry key and sub-keys:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \VolumeCaches