How To Auto Delete Temp Files in Windows 10/11 When PC starts

How To Increase Windows 10 and windows 11 Performance By Deleting Temp Files At Every Start Up:- Whenever a file is created, correspondingly a temporarily file is also created with the extension .TMP. These temporary files pile up in the hard drive space until you delete them. So what’s the problem with that, you may wonder. The more the space occupied in the hard drive by unwanted files, the lower the system performance would be. You can delete the temporary files either manually or you can assign a batch file to do this job for you. Both the ways are explained in detail through the following steps. So what are you waiting for? Let’s all work together for a better world which has efficient PCs.

Delete Temporary Files Automatically At Every Start Up

Want to be a little more techy? Or too lazy to clean up the temporary files every single time? Well, then let’s write a quick batch file which will do the job for you at every single startup.

1 – Launch Notepad. You can quickly launch the Notepad by opening the Run dialog box and by typing in Notepad and hitting enter key. You can open the Run dialog box by pressing the WIN+R keys together.





2 – Now copy paste the following code into your newly opened Notepad file.

rd %temp% /s /q
md %temp%



3 – The next step, obviously, is saving the file. But the question is where to save? It should be saved in the startup folder such that every time the system boots up, this file will be called and it will clean up all the temporary files that eat up your space unnecessarily.

4 – To save the file, hit CTRL+S keys together. Or you can click on the File tab at the top and then choose Save as option. Once the Save as window opens up, choose Save as type as All files. For the File name option, copy paste the following path and file name.

%appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat



5- The name of your file is cleantemp.bat. And you don’t have to bother to click and run it again and again, as it is kept in startup folder. So whenever your system boots up, the temporary files will be deleted by this batch file. If some of the files are in use, then they may not be deleted. In that case, try closing the running processes and run the batch file again. You can check whether the number of temporary files have reduced by going to the temporary files folder specified in Method 1.


6 – If you want to delete this cleaner file from the start up, you can just copy paste the path %appdata%\microsoft\windows\start menu\programs\startup in Windows file explorer and delete this file.




Hope you found the article useful. If you have doubts regarding any of the steps, please feel free to leave comments, we would be happy to help. Stay tuned for more updates on tricks, tips, and hacks.

4 thoughts on “How To Auto Delete Temp Files in Windows 10/11 When PC starts”

  1. Hi!
    I’ve been using this for 2 years, but unfortunately a program I use updated, and in the new version, it creates a folder that has “temp” in the name, which gets deleted due to this program. Is there a way to exclude this specific folder from deletion? Also, I do not see the manual deletion method 1 on this page, which is referenced a couple times.

Comments are closed.