This is the code i am using to erase all the temporary files in the user machines, but i want to make it NOT erase the bookmarks of Mozilla Firefox and Google Chrome, i already did some research and found out the file that stores the bookmarks in firefox is "places.sqlite" how can i exclude it from the execution? And in the case of Chrome i am still looking...
Also... there is a lot of "@echo we are cleaning this"
all around the code, to make it a litle user friendly and nice looking in general.
How i can make it so "file.exe"
is not deleted on this command or is there a better way to do this?
What i exactly want to do is, a .bat file that makes the user enviroment i enter using mstsc.exe
that is usualy a complete mess... something cleaner so that i can solve the users problem, this batch i made erase all the temporary files, browser profiles, cache of various programs, etc... of ALL USERS on a computer (and the computers i work with have so many users that windows makes temporary users) but i want to exclude some of the files from the process, so that the users dont complain about losing their Bookmarks, setting read only to these files is NOT an option and using third party programs, or code not suported inside a .bat
file also is not an option.
I am a begginer in this and english is not my native language please bear with me...
@echo.
@echo *******************************************************************************
@echo * Limpando os temporarios de todos os usuarios em %COMPUTERNAME%
@echo *******************************************************************************
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Local\Temp\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Local\Temp\"
@echo.
@echo *******************************************************************************
@echo * Limpando os temporarios do Windows em %COMPUTERNAME%
@echo *******************************************************************************
erase /F /S /Q "%SystemRoot%\TEMP\*.*"
for /D %%G in ("%SystemRoot%\TEMP\*") do RD /S /Q "%%G"
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Internet Explorer em %COMPUTERNAME%
@echo *******************************************************************************
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 260
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Local\Microsoft\Windows\Tempor~1\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Local\Microsoft\Windows\Tempor~1\"
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Google Chrome de todos os usuarios em %COMPUTERNAME%
@echo *******************************************************************************
taskkill /F /IM "chrome.exe">nul 2>&1
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Local\Google\Chrome\User Data\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Local\Google\Chrome\User Data\"
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Mozilla Firefox em %COMPUTERNAME%
@echo *******************************************************************************
taskkill /F /IM "firefox.exe">nul 2>&1
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Local\Mozilla\Firefox\Profiles\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Local\Mozilla\Firefox\Profiles\"
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Adobe Flash Player em %COMPUTERNAME%
@echo *******************************************************************************
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Local\Macromedia\Flash Player\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do erase /F /S /Q "%%G\AppData\Roaming\Macromedia\Flash Player\*.*"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Local\Macromedia\Flash Player\"
for /D %%G in ("%SystemDrive%\Users\*") do RD /S /Q "%%G\AppData\Roaming\Macromedia\Flash Player\"
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Java em %COMPUTERNAME%
@echo *******************************************************************************
javaws -uninstall
@echo.
@echo *******************************************************************************
@echo * Limpando cache do Spooler de impressao em %COMPUTERNAME%
@echo *******************************************************************************
NET STOP SPOOLER
NET START SPOOLER
@echo.
@echo *******************************************************************************
@echo * Limpando cache DNS em %COMPUTERNAME%
@echo *******************************************************************************
ipconfig /flushdns
ipconfig /registerdns
@echo.
@echo *******************************************************************************
@echo * Realizando Update das configuracoes de %USERNAME% em %COMPUTERNAME%
@echo *******************************************************************************
GPUpdate /force