While doing some system maintenance the other day, I noticed my Windows Temp directory had an unusually large number of files in it (over 1 GB). Upon browsing through the files, most simply appeared to be garbage.
Unlike the temporary Internet files, there isn’t an obvious way to limit the size of the temp directory, so instead I wrote up a batch file to clear out the folder for me. The only line in the file is:
del /q /f /s %temp%\*
I saved this file as “clean_temp.bat” and scheduled it to run monthly. This should work in 2000/XP/2003/Vista.


Jason Faulkner is the man who brings you our daily tips. He is based in Atlanta, Georgia.



Shanx said:
2/17/2008 3:36 am
Much nicer than these piecemeal hacks is to download CCleaner (free) and run it. It cleans up a whole lot of stuff beyond the temp folder, optimizes your registry, allows you to cleanly uninstall gunk software, and so forth.
[Reply]
Robert said:
2/17/2008 1:55 pm
About Clean temp , I like it the script but, without the quote…otherwise it will not work with the quote.
[Reply]
Jason Faulkner said:
2/18/2008 12:38 pm
Robert, thanks for pointing that out. When I checked what my script is, there were no quotes so I’m not sure why I added them… habit I guess.
Shanx:
I am not a big fan of CCleaner because:
1) I can clean temp files myself with the above script.
2) My browser manages the size of it’s own cache.
3) I NEVER mess with the registry when I don’t have to. “Cleaning”/”Optimizing” your registry, in my opinion is an extremely high risk with relatively low reward action.
4) I can’t really think of anything else I would need to really clean up. Something like removing log files or Windows Update temp files, I don’t do anyway since they don’t take up much space.
Additionally, I don’t see how using simple native OS functions is a “piecemeal” hack.
I respect your opinion… to each their own.
[Reply]
Shanx said:
2/19/2008 1:48 am
You’re right. We’re all comfortable with different things.
Piecemeal in the sense that you have to write an external script to use functions that should have a much simpler interface.
Cleaning the registry is a huge benefit in terms of Windows performance. Microsoft itself recommends that you use their free RegClean utility (part of Powertoys). This is particularly relevant for those of us who install and uninstall utilities all the time. Other than the most basic grandma users of Windows, I suspect this includes pretty much everyone.
CCleaner cleans a lot of things:
http://www.ccleaner.com/
I use four browsers for testing and CC cleans up after all of them. Only the things I request though — not the entire cache. For example, I don’t want to clean my authenticated sessions in Firefox which is my main browser and I can set CC up to leave them alone.
Anyway, my point was not to belittle your suggestion. It’s always nice to learn nifty little tricks. But there’s a difference between novelty of suggestion and actual practice. For the latter, I prefer CCleaner to do its job, which it does well.
PS. Not associated with CC in any way.
[Reply]
Justin Hierholzer said:
2/19/2008 9:59 am
Good luck using CCleaner when it changes your
Windows System files, and you are left with
“Windows cannot find the file HAL.DLL”!!
We had this nasty “portable” version cause all
kinds of issues for our managed clients.
Like I said - Good luck reinstalling Windows
PS: If your lucky and know that ccleaner has
messed up your system, DO NOT REBOOT - run the
System Restore utility to go back!
[Reply]
printman said:
3/8/2008 11:08 pm
wow. i cant believe how much i do NOT know, which is a relief, at the least i know i dont know that much..
im A+ certfied.. read two different books thoroughly before i went for the exam.. currently i work as a net admin.. those books never taught me how to write scripts like that.. how do i learn that?
thanks.
[Reply]