Skip to content | Skip to navigation
I am trying to use the Enviroment Variables %TEMP% and/or %USERPROFILE% to create a batch file that cleans out all the Temp directories on the machine.
Do anyone know how to specify the difference between the User Var %TEMP% and the System Var %TEMP%?
Ideally, I'd like one batch file that goes through all the user profiles and deletes everything from all Users' Temp folders and the System Temp folder.
But if there are a lot of users on the machine that will make a noticable performace loss. I might have to make a batch file that executes when the user logs in.
I'm also trying to include the Temporary Internet Files folder with something like:
del %USERPROFILE%\Local Settings\Temporary Internet Files\*
I'm not really sure this is smart. But I am so tired of finding spyware and viruses in this directory on other people's computers. If someone can think of some problems other than slightly slower browsing that will happen, please let me know.
On a side note, where do Firefox and Opera store their Internet cache? Is only the IE cache in the Temporary Internet Files folder?
Please contiune to vote AND post.
Nov 22, 2005 08:21 # 40660
null *** (12) has all the information you need...
User-defined variables always override system-defined variables with the same name (exceptions such as PATH apply), so there's no easy way to get both the user's TEMP and the system's TEMP, as the latter's value is overwritten by the former upon login.
If you don't want to (or can't) read the values from the registry in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment resp. HKCU\Environment directly, one possible way would be to run PsExec -s myscript.cmd to run your script under the SYSTEM account, which normally uses the system-defined temp. directory. Be careful to double-check the path in your script though - I've seen machines that give C:\WINDOWS as temp directory under some circumstances! You don't want to set a kill-all-that-moves script with unrestricted access rights onto your operating system.
(An even easier way would be to just use the default directory - %windir%\TEMP.)
Current versions of Opera store their stuff in %APPDATA%\Opera\Opera\profile\cache4. Firefox uses %APPDATA%\Mozilla\Firefox\Profiles\ random directory name\Cache. I don't think you need to delete their caches tho, as (unlike IE) they don't store stuff there that is subject to automatic execution.
"*sigh* Some men are really hard to manipulate!" - Orchid
This post was edited by null on Nov 22, 2005.
Current versions of Opera store their stuff in %APPDATA%\Opera\Opera\profile\cache4. Firefox uses %APPDATA%\Mozilla\Firefox\Profiles\ random directory name\Cache. I don't think you need to delete their caches tho, as (unlike IE) they don't store stuff there that is subject to automatic execution.
Yeah, I didn't want to clear their caches. I just wanted to make sure I wasn't deleting any of their stuff at the same time.
Please contiune to vote AND post.