redist-installer/Redist-Installer.bat
2022-09-06 23:42:51 -05:00

78 lines
2.7 KiB
Batchfile

@echo off
:: Permalink: https://chse.dev/redists
:: Run as Admin
set "params=%*"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
title Redist Installer
md %temp%\Redist-Installer >nul 2>&1
:: If we have all the offline installer files, copy and skip the downloading.
if exist "7za.dll" (
if exist "7za.exe" (
if exist "redists.zip" (
copy /Y 7za.dll %temp%\Redist-Installer >nul
copy /Y 7za.exe %temp%\Redist-Installer >nul
copy /Y redists.zip %temp%\Redist-Installer >nul
goto offlineInstall
)
)
)
:: If we do not have the offline installer files, download them.
:onlineInstall
cd %temp%\Redist-Installer
echo Downloading 1/3...
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/chxseh/Redist-Installer/releases/download/latest/7za.dll', '7za.dll')"
echo Downloading 2/3...
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/chxseh/Redist-Installer/releases/download/latest/7za.exe', '7za.exe')"
echo Downloading 3/3...
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/chxseh/Redist-Installer/releases/download/latest/redists.zip', 'redists.zip')"
:offlineInstall
cd %temp%\Redist-Installer
:: Extract Redists
start /wait /min 7za.exe e redists.zip -y
:: Install Redists
echo Installing 1/16...
vcredist2015_2017_2019_x86.exe /install /quiet /norestart
echo Installing 2/16...
vcredist2015_2017_2019_x64.exe /install /quiet /norestart
echo Installing 3/16...
2013_x86.exe /install /quiet /norestart
echo Installing 4/16...
2013_x64.exe /install /quiet /norestart
echo Installing 5/16...
2012_x86.exe /install /quiet /norestart
echo Installing 6/16...
2012_x64.exe /install /quiet /norestart
echo Installing 7/16...
2010_x86.exe /install /quiet /norestart
echo Installing 8/16...
2010_x64.exe /install /quiet /norestart
echo Installing 9/16...
2008_x86.exe /install /quiet /norestart
echo Installing 10/16...
2008_x64.exe /install /quiet /norestart
echo Installing 11/16...
2005_x86.exe /Q
echo Installing 12/16...
2005_x64.exe /Q
echo Installing 13/16...
start /wait DirectX.exe /Q
echo Installing 14/16...
start /wait DirectXA.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
echo Installing 15/16...
start /wait dotNET.exe /Q
echo Installing 16/16...
start /wait msxmlenu.msi /qn /L* "%temp%\XML Parser 4.0.log" /norestart ALLUSERS=2 >nul 2>&1
:: Cleanup
cd %temp%
rmdir %temp%\Redist-Installer /s /q
exit