confOS/windows/ctmpf.bat
2023-04-02 20:36:13 +02:00

45 lines
1.2 KiB
Batchfile

@ECHO off
:: Start as administrator
fltmc > NUL 2>&1 || (
PowerShell Start -Verb RunAs '%0' 2> NUL || (
EXIT 1
)
EXIT 0
)
ECHO CTMPF :: Clean TeMPorary Files
:: Empty the user's temp folder
ECHO Suppression des fichiers dans %TEMP%...
DEL /f /q %LOCALAPPDATA%\Temp\* 2> NUL
RMDIR /s /q "%TEMP%" 2> NUL
:: Empty the system's temp folder
ECHO Suppression des fichiers dans %WINDIR%\Temp...
RMDIR /s /q "%WINDIR%\Temp" 2> NUL
:: Empty the Prefetch folder
ECHO Suppression des fichiers dans %WINDIR%\Prefetch...
RMDIR /s /q "%WINDIR%\Prefetch" 2> NUL
:: 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
RMDIR /s /q "%SYSTEMDRIVE%\Windows.old"
)
:: Clear thumbnail cache
ECHO Efface la cache des miniatures de l'explorateur de fichiers...
DEL /f /s /q /a %LOCALAPPDATA%\Microsoft\Windows\Explorer\*.db
:: Clean disks
ECHO Nettoyage de l'ordinateur avec cleanmgr...
CD %WINDIR%\system32
cleanmgr /AUTOCLEAN
cleanmgr /VERYLOWDISK
EXIT /b