confOS/windows/ctmpf.bat
2022-12-12 00:10:20 +01:00

43 lines
1.1 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
rd /s /q "%TEMP%" 2> nul
:: Empty the system's temp folder
echo Suppression fichiers dans %WINDIR%\Temp...
rd /s /q "%WINDIR%\Temp" 2> nul
:: Empty the Prefetch folder
echo Suppression fichiers dans %WINDIR%\Prefetch...
rd /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
rd /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'ordinateur avec cleanmgr...
cd %WINDIR%\system32
cleanmgr.exe /AUTOCLEAN
cleanmgr.exe /VERYLOWDISK