confOS/windows/ctmpf.bat

46 lines
1.2 KiB
Batchfile
Raw Normal View History

2023-02-17 17:13:11 +01:00
@ECHO off
2022-12-12 00:08:32 +01:00
:: Start as administrator
2023-04-02 20:36:13 +02:00
fltmc > NUL 2>&1 || (
PowerShell Start -Verb RunAs '%0' 2> NUL || (
2023-02-17 17:13:11 +01:00
EXIT 1
2022-12-12 00:08:32 +01:00
)
2023-02-17 17:13:11 +01:00
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%...
2023-04-02 20:36:13 +02:00
DEL /f /q %LOCALAPPDATA%\Temp\* 2> NUL
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...
2023-04-02 20:36:13 +02: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...
2023-04-02 20:36:13 +02: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" (
2023-02-17 17:15:59 +01:00
ECHO Supprime l'ancienne installation de Windows dans %SYSTEMDRIVE%\Windows.old...
2023-02-17 17:13:11 +01:00
TAKEOWN /f "%SYSTEMDRIVE%\Windows.old" /a /r /d y
ICACLS "%SYSTEMDRIVE%\Windows.old" /grant administrators:F /t
RMDIR /s /q "%SYSTEMDRIVE%\Windows.old"
2022-12-12 00:08:32 +01:00
)
:: Clear thumbnail cache
2023-02-17 17:15:59 +01:00
ECHO Efface la cache des miniatures de l'explorateur de fichiers...
2023-02-17 17:13:11 +01:00
DEL /f /s /q /a %LOCALAPPDATA%\Microsoft\Windows\Explorer\*.db
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
EXIT /b