confOS/windows/clean.bat

64 lines
1.7 KiB
Batchfile
Raw Normal View History

2023-04-05 12:36:58 +02:00
@ECHO OFF
2022-12-12 00:08:32 +01:00
:: Start as administrator
2023-04-05 12:38:43 +02:00
fltmc >NUL 2>&1 || (
PowerShell Start -Verb RunAs '%0' 2>NUL || (
EXIT 1
)
EXIT 0
2022-12-12 00:08:32 +01:00
)
2023-02-17 17:13:11 +01:00
ECHO CTMPF :: Clean TeMPorary Files
2022-12-12 00:08:32 +01:00
:: Empty the user's temp folder
2023-02-17 17:15:59 +01:00
ECHO Suppression des fichiers dans %TEMP%...
2024-03-12 09:19:38 +01:00
DEL /S /F /Q %LOCALAPPDATA%\Temp\* 2>NUL
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "%TEMP%" 2>NUL
2022-12-12 00:08:32 +01:00
:: Empty the system's temp folder
2023-02-17 17:15:59 +01:00
ECHO Suppression des fichiers dans %WINDIR%\Temp...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "%WINDIR%\Temp" 2>NUL
2022-12-12 00:08:32 +01:00
:: Empty the Prefetch folder
2023-02-17 17:15:59 +01:00
ECHO Suppression des fichiers dans %WINDIR%\Prefetch...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "%WINDIR%\Prefetch" 2>NUL
2022-12-12 00:08:32 +01:00
:: Remove old Windows installation
if exist "%SYSTEMDRIVE%\Windows.old" (
ECHO Supprime l'ancienne installation de Windows dans %SYSTEMDRIVE%\Windows.old...
TAKEOWN /f "%SYSTEMDRIVE%\Windows.old" /a /r /d y
ICACLS "%SYSTEMDRIVE%\Windows.old" /grant administrators:F /t
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "%SYSTEMDRIVE%\Windows.old"
2022-12-12 00:08:32 +01:00
)
2023-07-09 10:46:33 +02:00
:: Empty useless files of Windows
ECHO Suppression des fichiers dans C:\$WinREAgent...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "C:\$WinREAgent" 2>NUL
2023-07-09 10:46:33 +02:00
ECHO Suppression des fichiers dans C:\Recovery...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "C:\Recovery" 2>NUL
2023-07-09 10:46:33 +02:00
2024-02-10 12:06:43 +01:00
:: Empty AMD installer files
ECHO Suppression des fichiers dans C:\AMD...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "C:\AMD" 2>NUL
2024-02-10 12:06:43 +01:00
:: Empty Windows generated logs
ECHO Suppression des fichiers dans C:\PerfLogs...
2024-02-22 00:26:55 +01:00
RMDIR /S /Q "C:\PerfLogs" 2>NUL
2024-02-22 00:26:51 +01:00
:: Delete Dump
ECHO Suppression des logs de la pile C:\DumpStack.log...
DEL /Q "C:\DumpStack.log" 2>NUL
2024-02-10 12:06:43 +01:00
2024-03-12 09:19:46 +01:00
:: Empty NVidia shader caches
ECHO Supprime les caches NVidia
DEL /S /F /Q %LOCALAPPDATA%Low\NVIDIA\PerDriverVersion\DXCache\* 2>NUL
DEL /S /F /Q %LOCALAPPDATA%\NVIDIA\GLCache\* 2>NUL
2022-12-12 00:08:32 +01:00
:: Clean disks
2023-02-17 17:15:59 +01:00
ECHO Nettoyage de l'ordinateur avec cleanmgr...
2023-02-17 17:13:11 +01:00
CD %WINDIR%\system32
2023-02-17 17:52:53 +01:00
cleanmgr /AUTOCLEAN
cleanmgr /VERYLOWDISK
2023-02-17 17:13:11 +01:00
2023-04-05 12:42:54 +02:00
EXIT /B