Windows 7 removing temporary files

I was amazed to find on my laptop a large number of files in various temporary folders.
So I created a batch file to clean them. Ideally this should be run when logging off but there appears to be no way to do this. So I created the following batch file which I added as a shortcut on my desktop. It would best run at start up so I added this to my startup folder. Here are the steps I did

  • run notepad
  • Type in the following (or cut and paste!)
CD C:\
  • Save the file as deltemp.bat or what ever you prefer, but make sure it ends in .bat
  • Close notepad

This script works under windows 7 But should work for other flavours of windows. You may not have the same temporary folders that I have, so this script may need to be adjusted accordingly, please be careful when running this script as it involves deleting files which is always inherently risky.

Since I saved my file into the root of the C: Drive I wanted to make a shortcut to it so I then right clicked on the desktop and selected New and then Shortcut afterwards I clicked on browse and navigated to the file and clicked OK. I left the name alone so it showed DELTEMP.BAT but rename it if you wish, then I clicked on finish which saved the shortcut on my desktop.

To get the shortcut into my startup programs which wasn’t as easy as it used to be (In my thinking anyway)

I did the following:

  1. Went to the start menu
  2. Selected All Programs
  3. Right clicked on Startup
  4. Selected open, which opened the folder in explorer
  5. Dragged the shortcut into the folder
  6. Closed the window

Since I don’t often log off and log on it will be a while until I use this script via the startup method, which is another reason for creating a shortcut so I can click on the shortcut at anytime and run the script at will if required.

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.