How To...: August 2007 Archives

[Note: An earlier version of this tip had some inaccuracies which were brought to my attention.  Thanks to Ed Bott for his keen eye!]

[Note #2: Ed's published a blog entry about this issue, and some additional notes that are well worth reading -- including a super-useful link to a tip on how to customize the way the Disk Cleanup tool runs.]

This is actually not an indictment of Vista alone, but something I've seen in Windows for quite some time now: the user profile \TEMP directory.  It fills up with the most amazing amount of trash imaginable, and over time it can cause programs to malfunction left and right in ways that defy analysis.

Vista does have a way to deal with it: the Disk Cleanup tool. which purges the \TEMP directory on demand.  However, as a safety measure, it doesn't delete anything newer than one week -- for instance, temporary files created as part of a program's installation process.

If you want to manually purge the \TEMP directory without the date cutoff restriction -- just blast everything in there -- here's one way to do it.  Copy the following into a text file with a .BAT extension:

rd /s /q "%localappdata%\temp" && md "%localappdata%\temp"

(That's all one line, by the way.)

When run, it'll erase the entire contents of the TEMP directory and then recreate it anew.

Two caveats:

  1. If there are any files that are in use in the directory, they will not be deleted.
  2. As hinted above, do not run this command when you're in the process of installing software, such as before a reboot to finalize a program installation.  It may delete components of the installer that are needed after the reboot.  (Note that if you attempted to install a program and the installer failed and left garbage in the \TEMP directory, it might not be a bad idea to purge all of that before attempting to re-run the installation.  Just make sure the installer is not actually running before attempting this!)

About this Archive

This page is a archive of entries in the How To... category from August 2007.

How To...: June 2007 is the previous archive.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.2rc3-en