A lot of space can be saved on your hard drive by clearing the Temp file, and here’s how safely delete the temp files from the previous day during boot.
Windows always has temp files and other junk that’s just taking up space on your hard drive. We’ve covered several ways to clean up the extra junk by using Disk Cleanup to using third-party utilities like CCleaner.
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
Now, save the file exactly as the path below:
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.