Even though hard drives are larger and cheaper than ever, we still need to clean up our PC. Apart from the files we create, Windows creates others such as temp files, error files and setup files which have limited value. One way to remove these space hogging files is to create a scheduled task with the disk cleanup tool to regularly delete files. Once you understand scheduled tasks, you’ll start automating other maintenance items. (Includes online tutorial.)There are many ways to cleanup your disk. Perhaps, the best known method is to highlight files and hit delete or drag them to the Recycle bin. This process works well for files we recognize or created. Behind the scenes, there are countless files created when you install software and browse the web. You don’t consciously think about these files since you never gave them a name. They are ancillary stuff occupying space and possibly slowing your computer.
Defining the Disk Cleanup with Sagesets
Microsoft added a disk cleanup tool to various versions of the operating system such as Windows XP. The tool is buried under several layers, but you can get to it from Start | All Programs | Accessories | System Tools. This gem of a program is called cleanmgr.exe.
You can run the program using the path mentioned above, but it requires that you select a drive and settings each time you use it. A more efficient way is to create a sageset that maintains your settings. You might think of a sageset like a profile written to the Windows registry. Rather than providing a profile name, Windows uses a number. You can have up to 65,535 sagesets.
To Create a Windows Disk Cleanup Sageset,
1. Click Start
2. Click Run?
3. In the Open: text box, type cleanmgr /sageset:1
4. Click OK.
5. In the Disk Cleanup Settings dialog, check the options that you would to delete.
6. Click OK.
Since you can have many sagesets, you could create one set to run daily and another to run weekly based on your usage. You just assign a different number and settings such as /sageset:2
One cautionary note is I wouldn’t delete Office Setup Files unless you’re short on disk space. I find it convenient to have these files remain on a computer in case I need to do a repair or reinstall. This is especially true if you’re traveling with a notebook and aren’t accustomed to packing the installation CDs.
Automate Disk Cleanup with Scheduled Tasks
Once you’ve created your sageset which tells Windows which files to delete during an automatic disk cleanup, you need to define when this process should run. This is done using the Scheduled Tasks tool found under Start | All Programs | Accessories | System tools or through Control Panel.
The Scheduled Tasks tool is another tool that is rarely used. It allows you to run a program on a predefined basis whether it is daily or a one time basis. It works with many programs and not just cleanmgr.exe. For our purposes, we will use it to run cleanmgr.exe with our defined sageset. This is done using the advanced features and the sagerun command.
To set a scheduled task with sagerun,
1. Click Start
2. Click Control Panel
3. Click Scheduled Tasks
4. Click Add Scheduled Tasks to start the Scheduled Task Wizard
5. Click Next. There will be a noticeable delay while the system retrieves your programs.
6. An alphabetical list displays with many of your programs. Most likely, you will not see cleanmgr.exe listed so you need to click Browse?
7. In the Select Program to Schedule dialog, click the Windows folder.
8. In the same dialog, click the system32 folder.
9. Click cleanmgr.exe
10. Click Open.
11. In the Scheduled Task Wizard, click the radio button for how often this task should be performed.
12. Click Next.
13. Set your time parameters.
14. Click Next.
15. Enter any passwords that might be required
16. Click Next
17. Click the checkbox for Open advanced properties for this when I click Finish.
18. In the cleanmgr dialog, type a space and then /sagerun:1 after the Run: line.
19. Click Apply.
20. Click OK.
When the designated time occurs, your custom cleanmgr program should kick off. If it doesn’t, open Scheduled Tasks and see if anything shows in the Status column.
Usually when I create a scheduled task, I test it by using a time 5 minutes out and watch the results. This way if anything is wrong such as password errors, I have the opportunity to correct sooner than later. Once the task runs to my liking, I edit the times by right-clicking and selecting properties from the Scheduled Tasks.
After you get the gist of how these tools work, you’ll probably set up scheduled tasks for other items besides disk cleanup. Although this trick may not stop you from needing another hard drive, it can delay that purchase and buy you some extra time.
Disk cleanup tool (cleanmgr) command line or scheduled task