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.

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:
C:\Users\[username]\AppData\Local\Temp.
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,
-
Press
Win + R
keys on your keyboard to open the Run dialogue box. -
With this box open, type "%temp%" as shown below then Press
Enter
. -
This will open up a new window known as the Temp folder containing all the junk data created by applications.
-
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 theDel
key on your keyboard or Right-click and select the trash icon as shown below. -
You will notice that some files cannot be deleted because they are open in a program.
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.
-
To avoid hitting the Skip button over and over, choose "Do this for all current items" then Skip as shown below.
-
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.
-
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
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.
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.
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
-
As you will notice, more unwanted files.
-
Open the Temporary files folder, select the files you want to delete then choose "Remove files" as shown below.
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 : )