![]() | ![]() |
Like Win98, Windows XP has a Disk Cleanup tool (Start Menu / All Programs / Accessories / System Tools / Disk Cleanup). But unlike the one in '98, this version has a longer reach, that is if you do this:
- Choose Run in the Start Menu and type "cleanmgr /sageset:1" (without the quotes) and press ENTER. The number can be anything between 1 and 65535. What you're doing here is setting up a cleaning profile for Disk Cleanup to use later on. When you type the above, a dialog box will appear with a list of junk file types that you can select for removal.
- Click OK after making your choices
- When you're ready to clean up, type: "cleanmgr /sagerun:1" (again without the quotes) and press ENTERDisk Cleanup will go to work on the debris you chose. If you haven't done a file cleanup in a while, the resulting action will surely be a huge slaughter after which you will see a sizable increase in the amount of free hard drive space.
If you want only certain types of files to be cleaned up for a given profile, give each set of preferences its own profile number. Only make sure to use that same number when typing the second of the two commands. Once you've built a profile with the /sageset switch, you can apply it at any time with /sagerun, without having to make your selections over again.
If typing commands gets old in a hurry, a shortcut might serve just as well. You could put one on the Desktop for example, with "cleanmgr /sagerun:1" as the command in the Type the location of the item: box. This shortcut would apply the choices you made when you typed "cleanmgr /sageset:1" to build the initial profile. Or a batch file could do the whole thing-- let you choose your cleaning options and apply them in one go... something like this:
@echo off
cleanmgr /sageset:n
cleanmgr /sagerun:n
@exit(n = any number between 1 and 65535)
(the second n must be the same number as that chosen in line 2)<><><><><><><><><><><><><><>
Here's a brief explanation on how to make the lines above into a usable batch file. It's so brief, it's barely a tutorial:
- Copy the lines (not the stuff in brackets) into the Windows Clipboard, by left-dragging your mouse over the text to highlight it, and using Copy from the Edit menu. Or highlight the text, right-click it, and choose Copy from the context menu. Be careful not to copy any empty space before the first line and after the last, or else some of the lines could get shunted to the right when you follow the third step.
- Start Menu / Run... / type notepad / press ENTER
- Use Edit / Paste (or right-click / paste) to place the text into Notepad.
- Choose File / Save As... / give the batch file whatever name you want, only make sure it has .bat as an extension, and is surrounded by quotation marks (e.g. "clean up this crud.bat").
- Pick your location from the Save in: box... Desktop might be a good place to put the file, for now at least.
For more on batch files, visit Gord's World of Batch Files and become a member of the free Batch World mailing list.
Still more info on batch files can be found here:
- Using batch files (Microsoft)
- Batch File Commands (Windows Support Center)
- Information On Batch Files (Computer Hope)
<><><><><><><><><><><><><><>IMPORTANT: Though Microsoft offers this Knowledge Base article called Disk Cleanup Tool Stops Responding While Compressing Old Files, I found that it didn't solve a problem I had where Disk Cleanup would stall. I leave Compress old files unchecked when running Disk Cleanup, yet the program seized up anyway. Here is a workaround (if not a solution) to the problem, should your situation be similar and Disk Cleanup freezes up on you:
- before starting Disk Cleanup, make sure to shut down as many programs as possible (browser, emailer, word processor, games etc)
- start Disk Cleanup as already described
- click the Cancel button a couple of times if Disk Cleanup jams up and you see this dialog. Yours will probably look different, as I use a white-on-black color scheme.
- start the Task Manager by doing one of the following:
- press CTRL+ALT+DEL
- right-click the Taskbar and choose Task Manager
- click the Start button / Run... / type taskmgr / press ENTER or click OK
- click the Processes tab and right-click cleanmgr.exe
- choose End Process and click Yes when this dialog appears
- exit the Task Manager and run Disk Cleanup again... Hopefully, Disk Cleanup won't stall this time. If it does, repeat the procedure until it unsticks. I've had to do it as much as four times on occasion.
Some links on Disk Cleanup, its automation, and cleaning up in general -- I doubt you'll need them all but here they are anyway:
- Langa.com: Newsletter for 2002-04-04
- The Elder Geek: Disk Cleanup Utility
- Microsoft: How to Automate the Disk Cleanup Tool in Windows XP
![]() | ![]() |