The Best Way to Automatically Clean Up the Temp Directory on Windows 10


Pretty much every version of Windows uses a special folder to store temporary files created by various Windows services and applications. Because they are temporary files, they can be safely deleted after they’ve done their duties. However, not every application is built to treat these temporary files the same way as they should be. Some did the better job clean them up after the job, but others may just leave them there. So if you don’t do the cleaning job yourself, you may end up wasting a lot of your storage spaces for it.

By default, there are two environment variables used to define where the temporary folder is. Most of the applications use one of these two variables to find out where to store their temporary files.

%TEMP% - %UserProfile%\AppData\Local\Temp
%TMP% - %UserProfile%\AppData\Local\Temp


There are many ways to clean it up. You can navigate to that folder and delete them there manually. Or use Windows’ built-in disk cleanup tool or a 3rd party tool like CCleaner to do the job. You can even automate the process by creating a batch file with the following code and putting it in the startup folder.

@echo off
del "%tmp%\*.*" /s /q /f
FOR /d %%p IN ("%tmp%\*.*") DO rmdir "%%p" /s /q

But no matter which way to choose, you will not clean up the temporary files completely because there will always be some apps running to hold the temporary files from being deleted. You will always end up having some leftovers after the process.

Except, if the temporary folder is set in the RAM Disk, all the content stored in the temporary folder will be wiped out clean whenever the computer reboots. And that would be the best way to automatically clean up the TEMP folder in Windows.

The tool I recommend using is called RAM Disk for Windows from SoftPerfect. Here is how you can set it up within a couple of minutes.

1. Install the tool on your Windows first.

2. Launch the tool and click the green plus icon to start adding a RAM Disk.


3. Select a proper size, if you don’t have enough RAM installed, 1 GB or even 512 MB should be a right size for the TEMP folder. Then pick a drive letter, choose NTFS as the file system and type TEMP in the folder list. And click OK to create and add the new disk.


4. Go to Tools in the tool and choose Set Windows TEMP folder…


5. Type in the new location of the temporary folder in RAM Disk in both variable boxes.


6. Click OK, and you are all set.



Please enter your comment!
Please enter your name here