Q108334: Clean the Temp Directory

The Temp directory is a folder used to store temporary files. When a program ends, the temporary files are deleted. However, sometimes these files are not deleted, for example, when a program is exited improperly. Cleaning, or deleting, the contents of the Temp directory frees up space on your hard disk.


To clean your Temp directory, you first need to determine its location on your hard drive. Then, you'll delete the contents of the directory using a MS-DOScommand or through Windows Explorer.

Determine the location of the Temp directory

  1. Select Start > Run.
  2. Launch the MS-DOS prompt:
    • If your using Windows NT 4.0, Windows 2000 or Windows XP, type cmd.
    • If your using Windows 95, 98 or ME, type command.com.
  3. Click OK.
  4. In the Command Prompt window, type set.
  5. Press Enter.
  6. Write down the location for TEMP.

Delete the contents of the Temp directory.

Choose one of the following methods to delete the contents of the Temp directory.

Note: Do not delete the Temp directory itself. Delete only the files and folders in the directory.

  1. Using a MS-DOS Command
    1. Click Start > Run.
    2. Type deltree /y temp_directory_location\*.*. For example:
      deltree /y C:\Windows\Temp\*.*

      temp_directory_location is the location of the Temp directory.

  2. Through Windows Explorer
    1. Double-click the My Computer icon on your desktop or select Start > Explore.
    2. Navigate to the location of the Temp directory, for example, C:\Windows\Temp.
    3. Select Edit > Select All.

    4. Select File > Delete.
    5. Click Yes or Yes to All in the dialog that appears.

    Last Modified Date: 10-02-2007ID: Q108334