How to delete temporary files in Windows 11

See how to declutter your PC and make it run smoother by deleting temporary files found in the temp folder in windows 11.

Deleting temporary files in Windows 11
Deleting temporary files in Windows 11

Temporary files are data files used by the operating system and software applications to store data when the applications are running or different tasks are being performed. These files can include cache files, installation files, internet files, log files, etc.

Why Delete Temporary Files?

Temporary files only serve a purpose when they are created and after the task behind them is completed, these files remain behind and accumulate over time eating up valuable space from your PC.

It goes without saying that temporary files slow down the overall performance of the computer especially when the files have accumulated filling up a large portion of your hard drive. See other ways you can use to speed up your PC in this article.

How to Fix Slow Boot Times on Windows 10
If your PC is taking too long to boot up, this article will show you some of the reasons behind it and some possible solutions.

Deleting temporary files in Windows 11

Knowing the implications of having temporary files, let's see how to remove them from our machines and free up some disk space.

Most temporary files are stored in the Windows temp folder found in this location:


The location may differ from PC to PC but the easiest way to head to that location is to use the Run dialogue box. To do that,

  1. Press Win + R keys on your keyboard to open the Run dialogue box.

    Img 1.png

  2. With this box open, type "%temp%" as shown below then Press Enter.

    Img 2.png

  3. This will open up a new window known as the Temp folder containing all the junk data created by applications.

    Img 3.png

  4. The next step is to delete all these files. To do so, press ctrl + A to select all the items in that folder then Press the Del key on your keyboard or Right-click and select the trash icon as shown below.

    Img 4.png

  5. You will notice that some files cannot be deleted because they are open in a program.

    Img 5.png

    In these cases, you can close down the program using the file or most practically, skip these files as they can be a handful and you may have no idea what program to close down.

  6. To avoid hitting the Skip button over and over, choose "Do this for all current items" then Skip as shown below.

    Img 6.png

  7. The process should finish successfully leaving your temp folder empty or almost empty. The remaining files are files that are still in use hence they cannot be deleted yet.

    The deletion process can take a few seconds or a couple of minutes depending on the number of files and their size. If the size of a file is too large to go to the recycle bin, you will be prompted to permanently delete those files.

  8. After the deletion process, head to your recycle bin and clear all the data in there. You can find the Recycle bin on your desktop. Right click on it and select Empty Recycle Bin

    Img 7.png

    You will then be prompted whether you want to permanently delete all the items in the recycle bin. Click Yes if there is nothing you need to restore from there.

    Img 8.png

    This will delete all the temp files that were deleted.

Automate the process for deleting temporary files.

If you find the above process tiresome or for some reason time-consuming, you can create a command prompt script that will automate the process of deleting temporary files. Here is how to do it.

Open your preferred text editor and type the following command.

rd %temp% /s /q

rd is a batch command used to remove directories. We can take advantage of this to completely delete the temp directory.

The /s flag in the command is used to include deletion even for the sub-folders.

The /q flag does away with the confirmation prompts.

Note: If the temp environment variable fails, you can replace the %temp% with the actual path to the temp folder. This is how the command will look like afterward.
rd "C:\Users\Geekbits\AppData\Local\Temp" /s /q

After typing the command into your editor, save it with the .bat extension.

Once you are done, all you have to do is just double-click the bat file to start the deletion process.

Delete other Temporary folders

The Temp folder isn't the only place where temporary files are stored. You can use the disk cleanup to get to the other temporary files. To do so,

  • Open the run dialogue box by pressing Win + R on your keyboard.

  • Once open type, "cleanmgr" then press Enter.

  • You will be prompted to select the drive you want to clean up. Leave it at the C: Drive and press Enter.

  • The disk cleanup window will appear and you can select the files you want to delete from here.

    Img 9.png

    Proceed when you are prompted to delete those files.

Other temporary files can be found using the system storage setting.

  • Open Setting by pressing win + I.

  • Choose Storage in the settings window

    img 10.png

  • As you will notice, more unwanted files.

    img 11.png

  • Open the Temporary files folder, select the files you want to delete then choose "Remove files" as shown below.

    IMg 12.png

Summing up

This article has shown some of the ways to declutter your personal computer to ensure that it runs as smoothly as possible. If you found the article helpful, be sure to share it with others.

Thanks for reading : )

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.