34 lines
901 B
Batchfile
34 lines
901 B
Batchfile
@echo off
|
|
setlocal
|
|
title Install MSVC 2022 Build Tools
|
|
|
|
fltmc >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Please right-click this file and choose "Run as administrator".
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
where winget.exe >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo winget was not found.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Installing MSVC 2022 Build Tools with winget (C++ workload, this may take a while)...
|
|
winget install --id Microsoft.VisualStudio.2022.BuildTools --exact --source winget ^
|
|
--accept-source-agreements --accept-package-agreements ^
|
|
--override "--passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
|
|
set "RC=%ERRORLEVEL%"
|
|
|
|
if "%RC%"=="0" (
|
|
echo Done.
|
|
) else if "%RC%"=="3010" (
|
|
echo Done. A reboot is required to finish the installation.
|
|
) else (
|
|
echo winget exited with code %RC%.
|
|
)
|
|
pause
|
|
exit /b %RC%
|