-1
3
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
The author wants to get rid of all the other users files except the bookmarks. The obvious solution is to perform a branching routine on the name of the file. – Ramhound – 2016-02-03T20:27:10.377
yes this will solve the problem, but... i need to clean these folders anyway because of file corruption caused by extreme bad use of the computers i handle in my work, i just want to keep the bookmarks so that the users dont complain about the vanishing of their links. – Kaosan Styngrey – 2016-02-03T21:14:54.303
and well... these may not be temporary files but it is where the user profiles of the respective browsers are stored, do you have a better solution to cleaning these browsers cache and history by using a batch command? – Kaosan Styngrey – 2016-02-03T21:58:36.033
1
Try this for Chrome (it deletes the cache folder and cookies and history files): http://superuser.com/questions/509063/how-to-delete-chrome-temp-data-history-cookies-cache-using-command-line
– Yisroel Tech – 2016-02-03T22:44:08.7601
And here are the files and folders to be deleted for Firefox: http://forums.mozillazine.org/viewtopic.php?p=2002634&sid=9fa426fdcc0d3da2ed975ee7b6037e11#p2002634
– Yisroel Tech – 2016-02-03T22:44:35.343