@echo off
chcp 65001 >nul
title Script de Nettoyage Avancé Windows 10/11 et Navigateurs
setlocal enabledelayedexpansion
:: --> Vérification moderne des droits Administrateur
net session >nul 2>&1
if %errorlevel% neq 0 (
echo [!] Demande des privilèges Administrateur en cours...
powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /B
)
:: --> Calcul de l'espace libre avant nettoyage (via PowerShell)
for /f %%a in ('powershell -Command "[math]::Round((Get-PSDrive C).Free / 1GB, 2)"') do set "FreeBefore=%%a"
cls
echo ============================================================
echo NETTOYAGE DU SYSTÈME WINDOWS (10 / 11)
echo ============================================================
echo Espace libre initial sur C: : !FreeBefore! Go
echo.
echo [-] Fermeture des navigateurs pour libérer les fichiers...
for %%b in (chrome.exe msedge.exe firefox.exe brave.exe) do (
taskkill /F /IM %%b /T >nul 2>&1
)
echo [-] Nettoyage des dossiers temporaires (Windows et Utilisateur)...
for %%d in ("%WINDIR%\Temp" "%TEMP%") do (
if exist "%%~d" (
del /s /f /q "%%~d\*.*" >nul 2>&1
for /d %%p in ("%%~d\*") do rd /s /q "%%p" >nul 2>&1
)
)
echo [-] Nettoyage du cache de mise à jour Windows (Windows Update)...
net stop wuauserv >nul 2>&1
net stop bits >nul 2>&1
if exist "%WINDIR%\SoftwareDistribution\Download" (
del /s /f /q "%WINDIR%\SoftwareDistribution\Download\*.*" >nul 2>&1
for /d %%p in ("%WINDIR%\SoftwareDistribution\Download\*") do rd /s /q "%%p" >nul 2>&1
)
net start bits >nul 2>&1
net start wuauserv >nul 2>&1
echo [-] Nettoyage du cache DNS et des miniatures...
ipconfig /flushdns >nul 2>&1
del /f /s /q /a "%LOCALAPPDATA%\Microsoft\Windows\Explorer\thumbcache_*.db" >nul 2>&1
echo [-] Vidage de la Corbeille...
powershell -Command "Clear-RecycleBin -Force -ErrorAction SilentlyContinue" >nul 2>&1
echo.
echo ============================================================
echo NETTOYAGE DES NAVIGATEURS (TOUS PROFILS)
echo ============================================================
echo.
:: Fonction de nettoyage pour navigateurs basés sur Chromium (Chrome, Edge, Brave)
for %%p in (
"%LOCALAPPDATA%\Google\Chrome\User Data"
"%LOCALAPPDATA%\Microsoft\Edge\User Data"
"%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data"
) do (
if exist "%%~p" (
echo [-] Nettoyage de %%~nxp...
for /d %%u in ("%%~p\*") do (
if exist "%%u\Cache" rd /s /q "%%u\Cache" >nul 2>&1
if exist "%%u\Code Cache" rd /s /q "%%u\Code Cache" >nul 2>&1
if exist "%%u\GPUCache" rd /s /q "%%u\GPUCache" >nul 2>&1
)
)
)
:: Nettoyage Firefox
if exist "%LOCALAPPDATA%\Mozilla\Firefox\Profiles" (
echo [-] Nettoyage de Mozilla Firefox...
for /d %%i in ("%LOCALAPPDATA%\Mozilla\Firefox\Profiles\*") do (
if exist "%%i\cache2" rd /s /q "%%i\cache2" >nul 2>&1
if exist "%%i\jumpListCache" rd /s /q "%%i\jumpListCache" >nul 2>&1
if exist "%%i\startupCache" rd /s /q "%%i\startupCache" >nul 2>&1
)
)
:: --> Calcul de l'espace libre après nettoyage
for /f %%a in ('powershell -Command "[math]::Round((Get-PSDrive C).Free / 1GB, 2)"') do set "FreeAfter=%%a"
for /f %%a in ('powershell -Command "[math]::Round(!FreeAfter! - !FreeBefore!, 2)"') do set "Gained=%%a"
echo.
echo ============================================================
echo NETTOYAGE TERMINÉ AVEC SUCCÈS !
echo ============================================================
echo Espace libre final sur C: : !FreeAfter! Go
echo Espace libéré estimé : !Gained! Go
echo ============================================================
echo.
pause



































.jpg)



.jpg)













.gz.jpg)













.jpg)


.jpg)







.jpg)



















.jpg)

























































.jpg)







.jpg)








.jpg)








.jpg)



















.jpg)











.jpg)
























.jpg)








.jpg)


.jpg)













.gz.jpg)













