For more, check out our article: Five Ways to Reclaim Windows Disk Space. Most of the methods in that article end up cleaning out the Temp folder, but you might want to keep that folder as clean as possible. Here’s how to create a bat file that will allow you to clean out the Temp file each time you boot up.
Windows Temp File
First, let’s take a look at the Temp folder in Windows. To get to it in Windows 7 type: %temp% in the search field in the Start menu, or on Windows 8.1, hit the Windows Key and type the same thing from the Start menu and hit Enter.
That opens the Temp folder, and if you want to clean it out manually, just hit Ctrl + A to select everything in it, and then Delete. Not all of the files and folders will be deleted though as those files are currently in use. In fact, you really don’t want to delete any temp files that were created since you booted up the PC for performance sake.
Create a Batch File to Automatically Clean Temp Folder
A lot of space can end up being saved on your hard drive by clearing out the Temp file. And if you shut down your PC every night, you can safely delete the temp files from the previous day during boot. Open Notepad and type in the following: rd %temp% /s /q md %temp% Now, save the file exactly as the path below: %appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat That will create your batch file and save it inside the Startup folder.
After creating the batch file, I rebooted my PC and opened the Temp folder, you can see there are far fewer files in it compared to the image above.
While Windows 8.x doesn’t have a Start menu, it has the Startup folder – here’s how to find it. So the cool thing is that the instructions above will work in both versions. Here’s another great free tool to clean junk from one’s computer: AFT Cleaner… Link: http://www.softpedia.com/get/Security/Secure-cleaning/ATF-Cleaner.shtml If you’re getting an error message, I am thinking it might be because it’s telling you a certain file cannot be deleted due to a program needing it? I guess I don’t know for sure unless you can get the exact error. Most of the people perform with files and folders still in open position. This prevents the corresponding temp.files from deleting them. I have a related question. Would you kindly let me if there are bat files to empty the windows’ temp folder? That too gets filled, as well the “windows\softwareDistribution\download”? Many thanks again and Merry Christmas! Cheers, D thank for the tip and..can we delete some of other cache folders which created by visual studio.. Regards, Ahmed Thank You To anyone looking to do this, I highly recommend it. You will not have any regrets in the matter. I think it was 7zip related. I had the same folder on my desktop and it would not delete. Found a post about it might be 7zip related. 7zip delete did get rid of it, but the empty temp folders were not touched. Trying 7zip would not delete them. The batch file worked great. Thanks! i do this press Windows+R write “temp” Press Enter there is files from: C:\Windows\Temp and write “%temp%” Press Enter there is files from: C:\Users\username\AppData\Local\Temp is it possible to make this code for two of them ? Thanks in advance. Comment Name * Email *
Δ Save my name and email and send me emails as new comments are made to this post.