How to Delete Temporary Files in Windows

Safely Delete Temp Files in Windows 10, 8, 7, Vista and XP

Screenshot showing how to delete temporary files in Windows
Windows Temp Folder (Windows 10).

One really easy way to free up some disk space in Windows is to delete temporary files, sometimes referred to as temp files. Temp files are exactly what they probably sound like: files that your operating system only needed to exist temporarily while in use, but are now just wasting space.

Most temporary files are stored in what's the called the Windows Temp folder, the location of which differs from computer to computer, and even user to user.

Locating your Temp folder is Step 1.

Manually cleaning out the Temp folder in Windows usually takes less than a minute but it could take longer depending on how large the collection of temporary files is.

Note: You can delete temp files in the way outlined below in any version of Windows, including Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP.

How to Delete Temporary Files in Windows

  1. In Windows 8.1 or later, right-click or tap-and-hold on the Start button and then choose Run.

    In Windows 8.0, the easiest way to access Run is from the Apps screen. In earlier versions of Windows, click on Start to bring up the search box or find Run.

    Another way to open the Run dialog box is to enter the Windows Key + R keyboard shortcut.
  2. In the Run window or search box, type the following command exactly:
    %temp%
    
    This command, which is technically one of many environment variables in Windows, will open the folder that Windows has designated as your Temp folder.
  1. Select all of the files and folders within the Temp folder that you want to delete. Unless you have a reason to otherwise, select them all.

    Tip: If you're using a keyboard or mouse, click on one item and then use the Ctrl+A keyboard shortcut to select every item within the folder. If you're on a touch-only interface, choose Select all from the Home menu at the top of the folder.

    Important: You don't need to know what each temp file you're going to delete is for, or what or how many files are included in any subfolders you select. Windows won't let you delete any files or folders that are still in use. More on that in a bit.
  1. Delete all the temporary files and folders you have selected, either using the Delete key on your keyboard or the Delete button from the Home menu.

    Note: Depending on your version of Windows, and how your computer is configured, you might be asked to confirm that you wish to Delete Multiple Items. You may even have to click Yes on a special Confirm Multiple File Delete window that appears. Handle any messages about hidden files in this folder the same way - it's fine to delete those, too.
  2. Tap or click Skip if you're presented with a File In Use or a Folder In Use warning during the temporary file deletion process.

    This is Windows telling you that the file or folder you're trying to delete is still in use by a program, or maybe even Windows itself. Skipping these allows the deleting to continue with the remaining data.

    Tip: If you're getting a lot of these messages, check the Do this for all current items checkbox and then tap or click Skip again. You'll have to do it once for the file messages and again for the folder ones, but warnings should stop after that.

    Note: Rarely you'll see a message like Error Deleting File or Folder that will stop the temp file deleting process completely. If this happens, restart your computer and try again. If even that doesn't work, try starting Windows in Safe Mode and repeating the steps above.
  1. Wait while all the temp files are deleted, which could take anywhere from a few seconds if you only have a few files in this folder, and up to several minutes if you have many and they're large.

    You won't be prompted when the process is complete. Instead, the progress indicator will just disappear and you'll see your empty, or almost empty, temp folder up on the screen. Feel free to close this window.
  2. Finally, locate Recycle Bin on your Desktop, right-click or tap-and-hold the icon, and then choose Empty Recycle Bin.

    Confirm that you want to delete the items, which will permanently remove those temporary files from your computer.

    Using a Command Line Command

    The steps shown above are considered the normal way to delete temporary files, but you of course have to do that manually. If you'd rather, you can build your own mini program that can delete these temp files automatically with a simple double-click of a BAT file.

    Doing this requires the rd (remove directory) Command Prompt command to delete the entire folder and all of the subfolders.

    Type the following command into Notepad or some other text editor, and save it with the .BAT file extension:

    rd %temp% /s /q

    The "q" parameter suppresses confirmation prompts to delete the files and folders, and "s" is for deleting all the subfolders and files in the temp folder.

    Other Types of Temporary Files in Windows

    The Windows Temp folder isn't the only place that temporary files, and other no-longer-needed groups of files, are stored on Windows computers.

    The Temp folder that you found in Step 1 above is where you'll find some of the operating-system-created temporary files in Windows but the C:\Windows\Temp\ folder contains a number of additional files that you no longer need to keep.

    Feel free to open that Temp folder and delete anything you find in there.

    Your browser also keeps temporary files, usually in an attempt to speed up your browsing by loading cached versions of web pages when you revisit them. See How to Clear Your Browser's Cache for help deleting these types of temporary files.

    Other, harder-to-find locations contain temporary files, too. Disk Cleanup, a utility included in all versions of Windows, can help remove the contents of some of those other temp folders for you automatically.

    Dedicated "system cleaners" like the free CCleaner program can make this, and similar jobs, really easy. Many free computer cleaner programs exist to choose from, including Baidu Cleaner and Wise Disk Cleaner.