How to automatically delete your Windows Temporary files during boot up

One really easy way to free up some disk space in Windows is to delete temporary files, sometimes referred to as temp files.

Temporary files are created on your PC for numerous reasons including when you browse the Internet, install programs, and by the operating system itself.

As the name implies, the Temporary files are the files that are only needed temporally.

Under normal conditions, these files are closed and deleted by Windows when you quit a Windows session. However, if you quit Windows in an irregular way (for example, restarting the computer or turning it off during an active Windows session) the files are not closed or deleted, resulting in wasted drive space.

Most temporary files are stored in what’s the called the Windows Temp folder, the location of which differs from computer to computer, and even user to user. Usually, the location of the temp folder is C:\users\username\AppData\Local\Temp, where username is your user account name.

Manually cleaning out the Temp folder in Windows usually takes less than a minute but it could take longer depending on how large the collection of temporary files is. And it is not practical for everyone browsing every time that folder manually and deleting it.

Here, I will show you a very easy method to delete your temporary files automatically during your PC boot up.

  • Open Notepad.

Please remember, there are a lots of methods available to open up your notepad depending on which operating system you are using.

If you are on Windows 10

  • Go to start menu, scroll down until you see Windows Accessories, Expand it and there you can see Notepad, just Click on it

Or if you are using Windows 7

The most common and easy way that opens up the notepad and works in all the versions of windows is Keyboard shortcut. Just press Win key and R simultaneously, a small Run dialogue box will opens up. Here type notepad and hit enter, you are ready to go.

  • Once you open up the notepad then type the code exactly given below:

rd %temp% /s /q

md %temp%


  • Now click on File > Save as and name it anything you like.

I suggest you to give a meaningful name. In my case I will name it as cleantemp.bat. Please don’t forget to chance the Save as type to All files. If you didn’t do so then it will be save as plane text file, not as a batch file, which will not work.

  • Now, save the file exactly as the path:

%appdata%\microsoft\windows\start menu\programs\startup\

That process will create your batch file and save it inside the Startup folder.

Now, save your all work and restart the PC. Once your PC boots up you can see the magic. Every time your PC boots up, all your temporary file from your temp folder will be automatically deleted.

Note that 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.

Hari Subedi is a Professional Computer Engineer and Technology enthusiast. He has completed Master in Science in Information Technology (M. Sc. IT) and Master in technology in Computer Science and Engineering (M. Tech. Eng). He usually writes in science and technology, life style and religion.

Leave a reply:

Your email address will not be published.