confOS/windows/ctmpf.bat

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 fichiers dans %TEMP%...
DEL /f /q %LOCALAPPDATA%\Temp\* 2> nul
RMDIR /s /q "%TEMP%" 2> nul
:: Empty the system's temp folder
ECHO Suppression fichiers dans %WINDIR%\Temp...
RMDIR /s /q "%WINDIR%\Temp" 2> nul
:: Empty the Prefetch folder
ECHO Suppression 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 %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 Effacer le cache des miniatures de l'explorateur de fichiers...
DEL /f /s /q /a %LOCALAPPDATA%\Microsoft\Windows\Explorer\*.db
:: Clean disks
ECHO Nettoyage de l'oRMDIRinateur avec cleanmgr...
CD %WINDIR%\system32
cleanmgr.exe /AUTOCLEAN
cleanmgr.exe /VERYLOWDISK
EXIT /b