Get rid of those pesky Windows XP temp files


I just recently stumbled upon a nifty way to make my windows xp machine run a little bit faster. Check it out.

If you search your entire computer for temp files, you may be surprised to find hundreds of megabytes worth of data that has been sitting around since God knows when. Windows is supposed to automatically delete these, but sometimes it just doesn’t happen. Now… supposedly when you boot up your computer or internet explorer, Windows will scan through your temp files (looking for recently viewed web pages, etc). So if everything is cluttered up, things might run a little bit slow.

So the goal here is to delete all temp files before we shut down the system at the end of the day. This way, everything is fresh and clean, come next morning!

  1. Open up a copy of notepad and paste in the following chunk of text:

    @echo off
    taskkill /F /FI "USERNAME ne SYSTEM" /FI "USERNAME ne LOCAL SERVICE" /FI "USERNAME ne NETWORK SERVICE" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne taskkill.exe"
    RD /S /q "%HOMEPATH%\Local Settings\History"
    RD /S /q "%HOMEPATH%\Local Settings\Temp"
    RD /S /q "C:\temp"
    RD /S /q "C:\Windows\Temp"
    SHUTDOWN -s -t 01


  2. Save the file off as "C:\shutdown.bat" (make sure you set the file type as "All Files", *not* "Text Documents")
  3. Browse to your C:\ drive using windows explorer and right-click on the shutdown.bat file. Select the "Create Shortcut" option in the context menu.
  4. Rename the shortcut file to "Clear Temp Files & Shut Down".
  5. Right-click on the shortcut and select "Properties" from the context menu.
  6. When the properties window pops up, make sure you are on the "Shortcut" tab and click on the "Change Icon" button. If it gives you some kind of error about the file not containing any icons, ignore it and just click OK.
  7. Where it says "Look for icons in this file:", make sure that it says, "%SystemRoot%\system32\SHELL32.dll".
  8. Select the red, square icon with the circle and a vertical line in the middle. This is the shutdown icon that you see when you click on your start button and select "Turn off your computer".
  9. Ok your way out of there back to your explorer window.
  10. Drag the shortcut to your desktop.

Now, whenever you want to shut down your computer, just double-click the icon on your desktop!
Windows will clear your temp files after killing all your programs (it can’t clear temp files if programs are currently using them), and then it will proceed to shut down.

IMPORTANT NOTE: If you are missing the taskkill.exe file, This guy provides a link to download it. Then just extract it to your C:\Windows\System32\ folder.


4 responses to “Get rid of those pesky Windows XP temp files”

  1. Yeah.. Well, keep in mind that the primary purpose of this tip is to get rid of your temp files with a single click of a button. You can’t get rid of your temp files if programs are using them, so this method kills all non-system tasks before doing it. Admittedly, running this program every day probably won’t increase your boot times significantly (because you never have time to build up a cache of temporary files and history). But maybe once every couple of weeks, just to keep things nice and sparkling clean.

  2. I think it is a better way to clean this stuff at a startup, so there is no tempfile locked (in use) an you don’t have to think about clean it up. I wrote a batchfile that do this for me every time i’m booting the system. It also removes the HUGE uninstall of Windows Update. For me it’s working fine, put it into your startup folder.

    NOTE: I use deltree, it is an old dos command from DOS 7.0 (windows 95).

    TIP: Run a defrag every day, not the slow Windows Defrag App but use “Auslogic Diskdefrag”, it’s must faster and it’s free.

    Here is the batch:

    @echo off
    rem ** remove next line if u want to keep your HUGE uninstall files of the installed service packs! i don’t
    deltree /y %windir%\$NtUninstall*.*

    deltree /y %homepath%\Local Settings\Temp\. >NUL
    deltree /y %homepath%\Local Settings\Temporary Internet Files\. >NUL
    deltree /y %homepath%\Onlangs geopend\. >NUL
    deltree /y %temp%\. >NUL
    deltree /y %SystemRoot%\Temp\. >NUL
    md %temp% >NUL

    rem ** put a readme.txt file in the temp dir(s)
    echo WARNING: This directory will be clean up every time the computer restarts!>%temp%\Readme!.txt
    echo WARNING: This directory will be clean up every time the computer restarts!>%SystemRoot%\Temp\Readme!.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.