Recently, a few forummers here was kind enough to pass me their batch files and among the batch files was one that's used to clear the temp folder. However in Windows XP there's another temp folder located in your profile settings and when I added the following lines to the batch files, nothing seems to happen to it, so what gives? del c:\windows\temp\*.* /Q del C:\Documents and Settings\Jeremy Tan\Local Settings\Temp\*.* /Q
The easiest way to know where to clear the files is to use the environment variables since that's also where Windows get the temp folders location. There's two folders and their environment variable name is TMP and TEMP (Note: myself, i always redefine the TMP and TEMP folders to C:\TEMP\ for easy management ) so you can actually use this del %TMP%\*.* /Q del %TEMP%\*.* /Q There's is one problem with deleting files this way. There's usually some files there that's still being used by windows. Thus, they are locked and there's nothing you can do to remove them. the only way is to run this script during boot time or right before windows shut down. one more things. The default del command is quite primitive as it cannot delete sub directories. My suggestions is to do a search online and get a more powerful del command that also allows you to delete sub directories. There are such utilities as I've used them before. Edit: Add attachment for delete.exe utility
Here's a forcedelete utility that I tried just now. Well, didn't actually try on system file . But I tried to delete an opened zip file. It worked on the locked file. It closed the handle and deleted the file. Nice.. Got it from... http://www.codeguru.com/Cpp/W-P/files/fileio/article.php/c1287/ The *.exe is in this folder.. NtSystemInfo\ForceDel\Release\
actually, you are NOT suppose to force delete those files that are being used in the TMP and TEMP folders... running programs will fail! or shut down! LOL
Yep peaz! That's why I never put those directories in the batch files. Programs use them as a backup, or long term temp files. I just compress them, because one time I deleted them and when I rebooted, a few things didn't open. Then when I tried to do a repair install, it said the setup files could not be found. Luckily, I left them in the recycling bin, so I just un-installed them. After that, everything was fine!
LOL! I didn't say you should use for the TMP or TEMP folders. Actually I never clear TEMP/TMP files coz sometimes there are installation files in there. Dang... actually I never clean my Internet temp or temp files, unless something goes wrong. That forcedelete was for you to forcedelete some files or folders that you can't delete coz some apps are using and you don't know which apps and you don't want to restart windows to release it. Last but not least, you have to know what files you are actually deleting to make sure after you delete it, your windows still runs normally.
Haha. posting that here might have confused some people mah. But it's a good find. THe only other utility i know of marks files for deletion when the pc restarts. Not forcing the apps to shut down to delete the file.