2 rem Decode VCVER variable and define related ones:
4 rem VCFMT - "vc" followed by full version number of Visual Studio toolset
5 rem (same as VCVER without optional suffix "-uwp")
6 rem VCLIB - name of folder contining binaries
7 rem (same as VCVER except without third version in number)
8 rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
10 rem Note that for VS before 2015 (vc14) always
11 rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
13 rem Since VS 2017, environment variables like VS100COMNTOOLS are not defined
14 rem any more, we can only use vswhere.exe tool to find Visual Studio.
15 rem Add path to vswhere.exe
16 set "PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
18 rem for vc10-12, interpretation is trivial
20 set VCLIB=%VCVER:~0,4%
21 set VCPROP=NativeDesktop
23 rem vc14 and later can have optional suffix "-uwp"
24 if "%VCVER:~-4%" == "-uwp" (
25 set VCFMT=%VCVER:~0,-4%
30 rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%