Longtime reader Jim ` offered to share his oh-so-sneaky method for killing temp files. I’m happy to share them today.

Jim’s commentary is in plain Roman type. The file contents are in boldface. This trick works because the first file causes the second to run early in the boot process, when some of these files are still out of use and deletable. That’s why Jim’s trick works for things that CCleaner can’t.

I recommend running this around the time of Patch Tuesday. That way, when your computer reboots, it’ll do some cleanup as it comes back. If you’re like me, that’s the only time the computer gets rebooted on any kind of a regular basis.

Here’s Jim.

1. Use this file to create a little registry entry to call the bat file on start-up. Some files can only be deleted before Windows fully starts, which is why I use this method. It will only run once. I stow it in a directory off the Start Menu called “Maintenance” where I keep a bunch of other maintenance related utilities.


Windows Registry Editor Version 5.00



2. My user name is “A Valued Customer” but I’m sure you figured that out. You’d have to change it to whatever you’re using as a User Name. Save this file as C:\Tempwin.bat
attrib -a -r -s -h “c:\documents and settings\a valued customer\local settings\history\*.*” /d /s
rd /q /s “c:\documents and settings\a valued customer\local settings\history\”
attrib -a -r -s -h “c:\documents and settings\administrator\local settings\history\*.*” /d /s
rd /q /s “c:\documents and settings\administrator\local settings\history\”

attrib -a -r -s -h “c:\temp\Temporary Internet Files\*.*” /d /s
rd /q /s “c:\temp\Temporary Internet Files\”

attrib -a -r -s -h “c:\Documents and Settings\All Users\Application Data\Avg9\Log\*.*” /d /s
rd /q /s “c:\Documents and Settings\All Users\Application Data\Avg9\Log\”

attrib -a -r -s -h “c:\Documents and Settings\All Users\Application Data\Avg9\emc\Log\*.*” /d /s
rd /q /s “c:\Documents and Settings\All Users\Application Data\Avg9\emc\Log\”

attrib -a -r -s -h  “C:\Documents and Settings\A Valued Customer\Application Data\Microsoft\Office\Recent\*.*” /d /s
rd /q /s  “C:\Documents and Settings\A Valued Customer\Application Data\Microsoft\Office\Recent\”

attrib -a -r -s -h “C:\Documents and Settings\administrator\Application Data\Microsoft\Office\Recent\*.*” /d /s
rd /q /s  “C:\Documents and Settings\administrator\Application Data\Microsoft\Office\Recent\”

attrib -a -r -s -h “C:\Documents and Settings\A Valued Customer\Recent\*.*” /d /s”
rd /q /s  “C:\Documents and Settings\A Valued Customer\Recent\”

attrib -a -r -s -h “C:\Documents and Settings\A Valued Customer\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\*.*” /d /s
rd /q /s  “c:\Documents and Settings\A Valued Customer\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\”

attrib -a -r -s -h “C:\Documents and Settings\A Valued Customer\Local Settings\Application Data\Google\GoogleEarth\*.*”rd /q /s  “c:\Documents and Settings\A Valued Customer\Local Settings\Application Data\Google\GoogleEarth\*.*”
del “C:\Documents and Settings\A Valued Customer\Application Data\Lavasoft\Ad-Aware\logs\AWEVLOG.txt”

I manually sort through and delete the rest of the crap that ends up in the Temp directory, including those darned GoogleUpdate directories. What’s with those guys? They should know better than that…