Cleaning all your temp files


Mon Oct 10, 2016 10:34 pm
Clan Leader
Top Dog
2600 Posts
Over time, when you download, install, uninstall, update, ect... on your PC, you get temp files that as created. Well, over time, you PC will start to slow down because of all these temp files. Well, a few days ago, i was talking to someone about a batch file that I put together that cleans my computer. Well, they had mentioned CCleaner and I had to mention to them that I have used CCleaner in the past, but it had a really nasty habit of deleting things i told it not to. I have thus reported to them and discovered the problem and fixed it, but before that happened, I created this batch file.

The funny thing is, a few months ago I download CCleaner and ran it and it cleaned my PC as promised, but I decided to run the batch file that I made and low and behold, CCleaner missed some. I am not going to claim that if you create this file and run it, your PC will be super fast, that is not going to happen. I am not also going to say that this is a replacement for CCleaner or any other program like Advanced System Care, because it's not.

But what I will say this, it doesn't hurt to run something that takes 1 min to make and a couple of second to run. I will tell you how to make it because it is VERY simple. You just need to be able to do 1 thing, you need to be able to see the file extensions.

What I mean by that is, if you create a text document on your desktop, (Right click -> New -> Text Document), and you see it on your desktop as something like "New Text Document.txt", (with the .txt which i highlighted), then you're already halfway done. If you can not see that, the do a Google search for "How to show file extensions on Windows * ?", where the * is your Windows version.

Once you can see that, then follow these simple instructions.

  1. Right click on your desktop and create a new text document and save it as CLEANUP.txt
  2. Open it and paste the following code into it;

    Code: [ Select all ]

    @echo off
    del /s /f /q c:\windows\temp\*.*
    rd /s /q c:\windows\temp
    md c:\windows\temp
    del /s /f /q C:\WINDOWS\Prefetch
    del /s /f /q %temp%\*.*
    rd /s /q %temp%
    md %temp%
    deltree /y c:\windows\tempor~1
    deltree /y c:\windows\temp
    deltree /y c:\windows\tmp
    deltree /y c:\windows\ff*.tmp
    deltree /y c:\windows\prefetch
    deltree /y c:\windows\history
    deltree /y c:\windows\cookies
    deltree /y c:\windows\recent
    deltree /y c:\windows\spool\printers
    del c:\WIN386.SWP

  3. Save the file.
  4. right click on the file and rename it, and change the .txt to .bat and save it.
  5. Now to run it, right click on it and run it as Administrator. The reason we want to do this is sometimes Windows 10 makes temp files permanently for no reason unless you remove them as Administrator, (Don't ask, I don't know why.).

When you save it, Windows will popup saying that changing the file type may cause it not to work, just click okay. Now, once that is done, anytime you want to run it, just double click on it and you will see a cmd window pop up and you will see it clean then close when done. That's it.

I personally run this once a day, before I log off, but that's also because I am working on sites, and downloading and editing and uploading all the time. For most of you, once a month, maybe once every two weeks or twice a year might be suitable for your situation, but again, this is all depending on what you do.


Sat Oct 15, 2016 3:30 pm
Clan Leader
No Life!!!
343 Posts
Thx Corpse!
big grin

Wed Nov 09, 2016 6:32 pm
Clan Leader
Top Dog
2600 Posts
No problem.

Wed Aug 16, 2017 8:36 am
Clan Leader
Top Dog
2600 Posts
Okay, just updated the instructions a little bit. One of the updates Windows release 2 months ago, and another one recently, put some temp files in permanently. Why, I don't know why. But with the script I give you in the first post, it will delete them if you run the script as Administrator. I have already done it and checked the integrity of my site by going in and typing CMD in my Windows search and right clicking and running Command Prompt App as Administrator. Then, I did run sfc /scannow and everything passed with no issues, and have been running on my PC for a few days with no issues.

So, if you use this little script to clean your PC, Just run it each time as Administrator.

Forums ©