Nettoyer Windows à l’arrêt de la machine.

Maitrisez à fond Windows 7: optimisation, réglages, conseils, astuces...
Avatar du membre
palerider
Administrateur du site
Administrateur du site
Messages : 6006
Enregistré le : lun. 21 mars 2011 09:18
Localisation : Vaucluse
A remercié : 38 fois
A été remercié : 223 fois
Contact :
    unknown unknown

Nettoyer Windows à l’arrêt de la machine.

Message par palerider »

Le principe est d'effacer certain fichiers à l’arrêt de la machine.

Bon c'est pas nouveau en cherchant sur le web on peut trouver divers tutos, ce sera juste un petit rappel.

Pour ce faire un utilisera un fichier bat où plusieurs, par exemple un pour les répertoires temporaires, un pour les cookies etc..., là dans l'exemple qui va suivre on va s'occuper du dossier Temp de Windows.

Le but est de montrer comment procéder, ensuite chacun pourra adapter le système à sa convenance.
Utiliser Notepad où bien Notepad++ etc... le tout est de bien mettre l'extension bat !

Fichier clean.bat

REM Effacer le dossier temporaire de Windows
del /s /f /q "%SystemRoot%"\temp\*
rmdir /s /q "%SystemRoot%"\temp\
mkdir "%SystemRoot%"\Temp

Placer le fichier dans C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown

Le dossier est caché il faut modifier les paramètres d’options des dossiers.

Une fois le fichier en place, Menu Démarrer puis taper : Gpedit.msc

Dans configuration de l’ordinateur sélectionner Scripts (démarrage/arrêt) suivre les images, à la fin cliquer sur Ok fermer l'éditeur. Image Image Image Image Image Version 1.0 à compléter où à modifier :)
J'aime les gens qui, pour briller, n'éteignent pas les autres.

Image
Avatar du membre
Prof
Administrateur du site
Administrateur du site
Messages : 8320
Enregistré le : lun. 5 avr. 2010 20:07
Localisation : Vosges
A remercié : 1 fois
A été remercié : 22 fois
Contact :
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par Prof »

Excellent palerider...

J'aime le principe, plus qu'a améliorer le tsoin tsoin :)
Règlement du forum
Toute demande d'aide ou de liens par MP est inutile !
kamarade
Membre VIP
Membre VIP
Messages : 977
Enregistré le : jeu. 3 févr. 2011 11:16
A remercié : 10 fois
A été remercié : 1 fois
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par kamarade »

Salut Palrider :hai:

Voilà j'ai tout bien fait comme tu dis, je viens de redémarrer ma machine et j'ai pas l'impression d'un changement peux tu me donner qque précision merci, comme quels fichiers sont supprimés etc... merci ;) ;)
Avatar du membre
palerider
Administrateur du site
Administrateur du site
Messages : 6006
Enregistré le : lun. 21 mars 2011 09:18
Localisation : Vaucluse
A remercié : 38 fois
A été remercié : 223 fois
Contact :
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par palerider »

Salut,

Je suppose que dans clean.bat tu as mis les lignes indiquées plus haut, dans ce cas tu vas vider le répertoire Temp de windows.
Quand j'ai fait le test j'avais 46 fichiers et dossiers dans ce répertoire, après redémarrage j'avais 2 sous répertoires et 3 fichiers tmp à la date d'aujourd'hui ce qui est normal.

J'ai fait un oubli ! pour pouvoir copier le fichier dans le répertoire indiqué il faut lancer l'explorateur en mode administrateur !

:)
J'aime les gens qui, pour briller, n'éteignent pas les autres.

Image
kamarade
Membre VIP
Membre VIP
Messages : 977
Enregistré le : jeu. 3 févr. 2011 11:16
A remercié : 10 fois
A été remercié : 1 fois
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par kamarade »

Ok merci je viens de vérifier et sa l'air bien puisque mon fichier temp de windows est vide ;) :hai: :hai:
Avatar du membre
Nash
Administrateur du site
Administrateur du site
Messages : 4403
Enregistré le : sam. 6 nov. 2010 14:19
Localisation : 89
A été remercié : 21 fois
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par Nash »

oui j'avais commencer un truc dans le genre mais pas eu le temps et le courage de continuer :(:( peut etre un jour

http://xllivc.1fichier.com/" onclick="window.open(this.href);return false;

attention , nettoyage pour utilisateur averti ;) le log est loin d'etre fini et n'a pas tellement ete tester :( :D
Image
• Ryzen 9 5900x
• B550 AORUS PRO 
• RTX 3060ti phoenix 
• thermaltake core p8 tg
• 1 x SSD 500GB   PCIe4 M.2 SEA
• 32 G DDR4 3600 corsaire
• Corsaire 1000w full modulaire passive
• MasterLiquid ML240R RGB
•1 to stockage NVME.M2 PCIe
chatonhub
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par chatonhub »

coucou ,
super idée
Avatar du membre
palerider
Administrateur du site
Administrateur du site
Messages : 6006
Enregistré le : lun. 21 mars 2011 09:18
Localisation : Vaucluse
A remercié : 38 fois
A été remercié : 223 fois
Contact :
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par palerider »

Une fois le fichier en place, pour le modifier il faut lancer l'éditeur de texte en mode Administrateur.

Pour info chez moi, j'efface le Temp de Windows et le Temp de mon compte utilisateur local.
Quand on le fait avec un utilitaire (genre Ccleaner etc...) ces répertoires sont mal nettoyés, là au redémarrage de l'ordi c'est clean, il y à juste 3 où 4 fichiers à la date du jour.

On peut envisager d'effacer les caches internet, les cookies, etc...

Il faut juste tester les scripts avant de les incorporer au fichier clean.bat où bien ajouter plusieurs fichiers bat.

:)
J'aime les gens qui, pour briller, n'éteignent pas les autres.

Image
chatonhub
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par chatonhub »

sur le même principe je vous joint mon .bat
ci-dessous ce qu'il fait ^^
---------[ SUPPRESSION ] ---------

/----- Fichier temps d'applications
/----- Fichiers recents
/----- Dossiers TEMPS
/----- Prefetch
/----- Fichiers LOGS et autres
/----- Corbeille
/----- [ INTERNET EXPLORER ]
/----- Cookies
/----- Temporary Internet Files
/----- Historique
/----- [ MOZILLA FIREFOX ]
@echo off



TITLE + Utilisateur: %USERNAME% ^| netoyeur-team-aaz © ^| ( %time:~0,2%h %time:~3,2% min )

mode con cols=80 lines=16 &color a

echo.

echo.

echo.

echo Avertissement: Ce logiciel est distribu‚ "tel quel". Vous ˆtes le seul

echo responsable si vous utilisez ce logiciel.

echo Si vous perdez des donn‚es par exemple VOUS ETES LE SEUL RESPONSABLE

echo Ce programme est … utiliser … vos risques et p‚rils !

echo Si vous n'acceptez pas cela, quitt‚ ce programme imm‚diatement !

echo.

echo.

echo.

pause



Rem ----------------------------------------------------------------------------



Del /Q "%systemdrive%\team-aaz.txt" 2>NUL >NUL



Rem ----------------------------------------------------------------------------



set HKLMIE=HKLM\Software\Microsoft\Internet Explorer

set curver=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion

set SF=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

set curver=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

set process=HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0



For /f "tokens=2-3 delims=\" %%a in ('reg query "%SF%" ^| Find /i "Common AppData"') do set DAS=%systemdrive%\%%a

if not "%DAS%"=="%systemdrive%\Documents and Settings" set DAS=%systemdrive%\Users

set AD=AppData\Roaming

if "%DAS%"=="%systemdrive%\Documents and Settings" set AD=Application Data



Rem ----------------------------------------------------------------------------



:: Début du rapport



echo team-aaz > "%systemdrive%\team-aaz.txt"

echo Debut a %time:~0,5% le %date% >> "%systemdrive%\team-aaz.txt"



:: Version, Service Pack Windows



for /f "tokens=3,*" %%a in ('reg query "%curver%" ^| Find "ProductName"') do (

for /f "tokens=3,*" %%i in ('reg query "%curver%" ^| Find "CSDVersion"') do (

echo OS: %%a %%b %%i %%j >> "%systemdrive%\team-aaz.txt"

set ver=%%a %%b)

)

:: Nom du processeur



For /f "tokens=3,*" %%i IN ('REG QUERY "%process%" ^| Find "ProcessorNameString"') do (

echo Processeur : %%i %%j >> "%systemdrive%\team-aaz.txt")



:: Déifinition du mode de démarrage



if not defined safeboot_option (

echo Mode de boot: Normal >> "%systemdrive%\team-aaz.txt")

) else ( echo Boot mode: Safeboot >> "%systemdrive%\team-aaz.txt")



:: Version IE et FF



For /f "tokens=3" %%a in ('reg query "%HKLMIE%" ^| Find "W2kVersion"') do (

echo Internet Explorer %%a >> "%systemdrive%\team-aaz.txt")



if defined FFound (

For /f "tokens=3,*" %%a in ('reg query "%HKLMFF%" 2^>NUL ^| Find "CurrentVersion" 2^>NUL') do (

echo Mozilla Firefox %%a %%b >> "%systemdrive%\team-aaz.txt")

)



:: Chemin du batch



echo Lance de %~0 ^(%username%^) >> "%systemdrive%\team-aaz.txt"

echo. >> "%systemdrive%\team-aaz.txt"



Rem ----------------------------------------------------------------------------

cls

echo.

echo.

echo Chat Par [%date%]

echo.

echo Lanc‚ sur %username%: %ver%

echo.

echo Ne pas copier, diffuser, modifier le code sans l'autorisation !

echo.

echo --------------------------------------------------------------------------------

echo Scan en cours, veuillez patienter...

echo.

echo --------------------------------------------------------------------------------



echo ---------[ SUPPRESSION ] --------- >> %systemdrive%\team-aaz.txt



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Fichier temps d'applications >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Sun\Java\Deployment\cache\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Sun\Java\Deployment\cache\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Sun\Java\Deployment\cache\%%i" echo %DAS%\%%e\%AD%\Sun\Java\Deployment\cache\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Macromedia\Flash Player\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Macromedia\Flash Player\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Macromedia\Flash Player\%%i" echo %DAS%\%%e\%AD%\Macromedia\Flash Player\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Real\RealPlayer\History\*.lnk" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Real\RealPlayer\History\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Real\RealPlayer\History\%%i" echo %DAS%\%%e\%AD%\Real\RealPlayer\History\%%i >> %systemdrive%\team-aaz.txt)

)







For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Lavasoft\Ad-Aware\Logs\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Lavasoft\Ad-Aware\Logs\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Lavasoft\Ad-Aware\Logs\%%i" echo %DAS%\%%e\%AD%\Lavasoft\Ad-Aware\Logs\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Google\GoogleEarth\dbCache.dat*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Google\GoogleEarth\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Google\GoogleEarth\%%i" echo %DAS%\%%e\%AD%\Google\GoogleEarth\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Google\Local Search History\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Google\Local Search History\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Google\Local Search History\%%i" echo %DAS%\%%e\%AD%\Google\Local Search History\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\Lavasoft\vlc\cache\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\Lavasoft\vlc\cache\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\Lavasoft\vlc\cache\%%i" echo %DAS%\%%e\%AD%\Lavasoft\vlc\cache\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\OLYMPUS Master\database\*.bk1" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\OLYMPUS Master\database\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\OLYMPUS Master\database\%%i" echo %DAS%\%%e\%AD%\OLYMPUS Master\database\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\OLYMPUS\OLYMPUS Master\store\*.bk1" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\OLYMPUS\OLYMPUS Master\store\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\OLYMPUS\OLYMPUS Master\store\%%i" echo %DAS%\%%e\%AD%\OLYMPUS\OLYMPUS Master\store\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /b /a-d "%DAS%\%%e\%AD%\.thumbnails\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\%AD%\.thumbnails\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\.thumbnails\%%i" echo %DAS%\%%e\%AD%\.thumbnails\%%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

IF EXIST "%DAS%\%%e\%AD%\OpenOffice.org2\user\registry\data\org\openoffice\Office\Common.xcu" (

DEL /Q "%DAS%\%%e\%AD%\OpenOffice.org2\user\registry\data\org\openoffice\Office\Common.xcu" 2>NUL >NUL &if not exist "%DAS%\%%e\%AD%\OpenOffice.org2\user\registry\data\org\openoffice\Office\Common.xcu" echo %DAS%\%%e\%AD%\OpenOffice.org2\user\registry\data\org\openoffice\Office\Common.xcu >> %systemdrive%\team-aaz.txt)

)







For %%a in (

"%ProgramFiles%\AusLogics Disk Defrag\reports\*.html"

"%ProgramFiles%\Lavasoft\Ad-Aware SE Personal\defs.ref.old"

"%ProgramFiles%\Ahead\Nero\NeroHistory.log"

"%allusersprofile%\%AD%\Spybot - Search ^& Destroy\backups\*.*"

"%allusersprofile%\%AD%\Spybot - Search ^& Destroy\logs\*.*"

"%allusersprofile%\%AD%\Spybot - Search ^& Destroy\recovery\*.*"

"%allusersprofile%\%AD%\Avira\AntiVir PersonalEdition Classic\LOGFILES\avguard.log"

"%allusersprofile%\%AD%\Microsoft\Dr Watson\*.dmp"

"%ProgramFiles%\EMULE\CONFIG\AC_SearchStrings.dat"

"%programfiles%\NETSCAPE\USERS\DEFAULT\netscape.hst"

"%programfiles%\NETSCAPE\USERS\DEFAULT\cookies.txt"

"%programfiles%\NETSCAPE\USERS\DEFAULT\CACHE\*.*") do if exist %%a (

DEL /Q %%a 2>NUL >NUL &if not exist %%a echo %%~a >> %systemdrive%\team-aaz.txt)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Fichiers recents >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



for /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

for /f "tokens=*" %%i in ('dir /b "%DAS%\%%e\Recent\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\Recent\%%i" 2>NUL >NUL &if not exist "%DAS%\%%e\Recent\%%i" echo %DAS%\%%e\Recent\%%i >> %systemdrive%\team-aaz.txt)

)



for /f "tokens=*" %%i in ('dir /b "%WINDIR%\System32\config\systemprofile\Recent\*.*" 2^>NUL') do (

DEL /Q "%WINDIR%\System32\config\systemprofile\Recent\%%i" 2>NUL >NUL &if not exist "%WINDIR%\System32\config\systemprofile\Recent\%%i" echo %WINDIR%\System32\config\systemprofile\Recent\%%i >> %systemdrive%\team-aaz.txt)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Dossiers TEMPS >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



For /f "tokens=*" %%i in ('dir /s /b /ad "%WINDIR%\system32\config\systemprofile\Local Settings\Temp" 2^>NUL') do (

RD /S /Q "%%i" &if not exist "%%i" echo %%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /s /b /a-d "%WINDIR%\system32\config\systemprofile\Local Settings\Temp" 2^>NUL') do (

DEL /Q "%%i" 2>NUL >NUL &if not exist "%%i" echo %%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /s /b /ad "%WINDIR%\Temp" 2^>NUL') do (

RD /S /Q "%%i" 2>NUL >NUL &if not exist "%%i" echo %%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /s /b /a-d "%WINDIR%\Temp" 2^>NUL') do (

DEL /Q "%%i" 2>NUL >NUL &if not exist "%windir%\Temp\%%i" echo %windir%\Temp\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /s /b /ad "%DAS%\%%e\LOCALS~1\Temp" 2^>NUL') do (

RD /S /Q "%%i" 2>NUL >NUL &if not exist "%%i" echo %%i >> %systemdrive%\team-aaz.txt)

)



For /f "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /f "tokens=*" %%i in ('dir /s /b /a-d "%DAS%\%%e\LOCALS~1\Temp" 2^>NUL') do (

DEL /Q "%%i" 2>NUL >NUL &if not exist "%%i" echo %%i >> %systemdrive%\team-aaz.txt)

)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Prefetch >> %systemdrive%\team-aaz.txt



Echo. >> %systemdrive%\team-aaz.txt



for /f "tokens=*" %%i in ('dir /b "%WINDIR%\Prefetch\*.pf" 2^>NUL') do (

DEL /Q "%WINDIR%\Prefetch\%%i" 2>NUL >NUL &if not exist "%WINDIR%\Prefetch\%%i" echo %WINDIR%\Prefetch\%%i >> %systemdrive%\team-aaz.txt)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Fichiers LOGS et autres >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\MiniDump\*.dmp" 2^>NUL') do (

DEL /Q "%WINDIR%\MiniDump\%%i" 2>NUL >NUL &if not exist "%WINDIR%\MiniDump\%%i" echo %WINDIR%\MiniDump\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\*.log" 2^>NUL') do (

DEL /Q "%WINDIR%\%%i" 2>NUL >NUL &if not exist "%WINDIR%\%%i" echo %WINDIR%\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\Debug\*.log" 2^>NUL') do (

DEL /Q "%WINDIR%\Debug\%%i" 2>NUL >NUL &if not exist "%WINDIR%\Debug\%%i" echo %WINDIR%\Debug\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\system32\wbem\Logs\*.lo*" 2^>NUL') do (

DEL /Q "%WINDIR%\system32\wbem\Logs\%%i" 2>NUL >NUL &if not exist "%WINDIR%\system32\wbem\Logs\%%i" echo %WINDIR%\system32\wbem\Logs\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\security\logs\*.log" 2^>NUL') do (

DEL /Q "%WINDIR%\security\logs\%%i" 2>NUL >NUL &if not exist "%WINDIR%\security\logs\%%i" echo %WINDIR%\security\logs\%%i >> %systemdrive%\team-aaz.txt)



For /f "tokens=*" %%i in ('dir /b "%WINDIR%\Debug\UserMode\*.log" 2^>NUL') do (

DEL /Q "%WINDIR%\Debug\UserMode\%%i" 2>NUL >NUL &if not exist "%WINDIR%\Debug\UserMode\%%i" echo %WINDIR%\Debug\UserMode\%%i >> %systemdrive%\team-aaz.txt)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Corbeille >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



Echo. >> %systemdrive%\team-aaz.txt

For %%i in (A:, B:, C:, D:, E:, F:, G:, H:, I:, J:, K:, L:, M:, N:, O:, P:, Q:, R:, S:, T:, U:, V:, W:, X:, Y:, Z:) do (

For /F "tokens=*" %%a in ('dir /b /s /a-d "%%i\RECYCLER\" 2^>NUL') do (

DEL /Q /S "%%a" 2>NUL >NUL &if not exist "%%a" echo %%a >> %systemdrive%\team-aaz.txt)

)



For %%i in (A:, B:, C:, D:, E:, F:, G:, H:, I:, J:, K:, L:, M:, N:, O:, P:, Q:, R:, S:, T:, U:, V:, W:, X:, Y:, Z:) do (

For /F "tokens=*" %%a in ('dir /b /s /ad "%%i\RECYCLER\" 2^>NUL') do (

RD /S /Q "%%a" 2>NUL >NUL &if not exist "%%a" echo %%a >> %systemdrive%\team-aaz.txt)

)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- [ INTERNET EXPLORER ] >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Cookies >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



tskill iexplore 2>NUL



ping localhost -n 2 > nul

For /F "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /F "tokens=*" %%i in ('dir /b "%DAS%\%%e\Cookies\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\Cookies\%%i" 2>NUL >NUL &IF NOT EXIST "%DAS%\%%e\Cookies\%%i" echo "%DAS%\%%e\Cookies\%%i" >> %systemdrive%\team-aaz.txt)

)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Temporary Internet Files >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



For /F "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /F "tokens=*" %%i in ('dir /b "%DAS%\%%e\Local Settings\Temporary Internet Files\*.*" 2^>NUL') do (

DEL /Q "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" 2>NUL >NUL &IF NOT EXIST "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" echo "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" >> %systemdrive%\team-aaz.txt)

)



For /F "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /F "tokens=*" %%i in ('dir /b /ad "%DAS%\%%e\Local Settings\Temporary Internet Files" 2^>NUL') do (

RD /S /Q "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" 2>NUL >NUL &IF NOT EXIST "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" echo "%DAS%\%%e\Local Settings\Temporary Internet Files\%%i" >> %systemdrive%\team-aaz.txt)

)



if exist "%windir%\Temporary Internet Files" (

RD /S /Q "%windir%\Temporary Internet Files" 2>NUL >NUL &IF NOT EXIST "%windir%\Temporary Internet Files" echo "%windir%\Temporary Internet Files" >> %systemdrive%\team-aaz.txt)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- Historique >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



For /F "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /F "tokens=*" %%i in ('dir /b /ad "%DAS%\%%e\Local Settings\Historique" 2^>NUL') do (

RD /S /Q "%DAS%\%%e\Local Settings\Historique\%%i" 2>NUL >NUL &IF NOT EXIST "%DAS%\%%e\Local Settings\Historique\%%i" echo "%DAS%\%%e\Local Settings\Historique\%%i" >> %systemdrive%\team-aaz.txt)

)



Echo. >> %systemdrive%\team-aaz.txt

echo /----- [ MOZILLA FIREFOX ] >> %systemdrive%\team-aaz.txt

Echo. >> %systemdrive%\team-aaz.txt



tskill firefox 2>NUL

ping localhost -n 2 > nul



For /F "tokens=*" %%e in ('dir /b /ad "%DAS%"') do (

For /F "tokens=*" %%i in ('dir /b /ad "%DAS%\%%e\Local Settings\%AD%\Mozilla\Firefox\Profiles" 2^>NUL') do (

For %%a in (

Cache\*.*

Cache^(2^)\*.*

history.dat

downloads.rdf

cookies.txt) do (

if exist "%DAS%\%%e\Local Settings\%AD%\Mozilla\Firefox\Profiles\%%i\%%a" (

DEL /Q "%DAS%\%%e\Local Settings\%AD%\Mozilla\Firefox\Profiles\%%i\%%a" 2>NUL >NUL &IF NOT EXIST "%DAS%\%%e\Local Settings\%AD%\Mozilla\Firefox\Profiles\%%i\%%a" echo "%DAS%\%%e\Local Settings\%AD%\Mozilla\Firefox\Profiles\%%i\%%a" >> %systemdrive%\team-aaz.txt)

)

)

)



echo. >> %systemdrive%\team-aaz.txt

Echo ******** Fin a %time:~0,5% le %date% ******** >> %systemdrive%\team-aaz.txt

cls

echo.

echo.

echo team-aaz [%date%]

echo.

echo Lanc‚ sur %username%: %ver%

echo.

echo Ne pas copier, diffuser, modifier le code sans l'autorisation de !

echo.

echo --------------------------------------------------------------------------------

echo Analyse terminer

echo.

echo --------------------------------------------------------------------------------

pause

notepad %systemdrive%\team-aaz.txt
Fichiers joints
NetoyeurTemp.rar
(2.95 Kio) Téléchargé 593 fois
Modifié en dernier par chatonhub le lun. 2 janv. 2012 13:29, modifié 1 fois.
Avatar du membre
Prof
Administrateur du site
Administrateur du site
Messages : 8320
Enregistré le : lun. 5 avr. 2010 20:07
Localisation : Vosges
A remercié : 1 fois
A été remercié : 22 fois
Contact :
    unknown unknown

Re: Nettoyer Windows à l’arrêt de la machine.

Message par Prof »

un joli .bat :clap:

Merci pour le partage !
Règlement du forum
Toute demande d'aide ou de liens par MP est inutile !
Répondre