Batch file for deleting temporary files

Martijn Langohr

Reputable
Jul 5, 2015
25
0
4,530
Hello guys,

I've just made a very simple batch file for cleaning my temp folder. I've put the .bat file in my startup folder so it would clean TEMP when i log in. I've wrote down the following lines:

rd D:\TEMP /s /q
md D:\TEMP

As i said, very simple. But the problem is that it is not working. I also think i know why; there are files and folders in the temporary folder that are in use so the batch file can't delete them. But my question is, do you guys know how to solve this?

Thanks
 
Solution
You can bring up File Explorer and right-click C:, then click Properties. Then on the General tab click Disk Cleanup. That will do it.

Good luck.

TRENDING THREADS