Info,  Windows

Script for disk cleanup

@echo off
REM Install Disk Cleanup based on Windows Version

ver | findstr /i “6\.0\.” > nul
IF %ERRORLEVEL% EQU 0 goto ver_2008
ver | findstr /i “6\.1\.” > nul
IF %ERRORLEVEL% EQU 0 goto ver_2008R2
goto warn_and_exit

:ver_2008
:Run Windows 2008 specific commands here
echo OS Version: Windows 2008
IF NOT EXIST “%SYSTEMDRIVE%\Program Files (x86)” goto ver_2008_x86
echo 64-bit

copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end

:ver_2008_x86
echo 32-bit

copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end
:ver_2008R2
:Run Windows 2008R2 specific commands here
echo OS Version: Windows 2008 R2

copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe C:\Windows\System32\
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui C:\Windows\System32\en-US\
cleanmgr.exe

goto end

:warn_and_exit
echo Machine OS cannot be determined.

:end

Leave a Reply

Your email address will not be published. Required fields are marked *

*