1:: Copyright 2017 - Refael Ackermann 2:: Distributed under MIT style license 3:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf 4:: version: 2.0.0 5 6@if not defined DEBUG_HELPER @ECHO OFF 7setlocal 8if "%~2"=="prerelease" set VSWHERE_WITH_PRERELEASE=1 9set "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" 10if not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer" 11if not exist "%InstallerPath%" goto :no-vswhere 12:: Manipulate %Path% for easier " handeling 13set "Path=%Path%;%InstallerPath%" 14where vswhere 2> nul > nul 15if errorlevel 1 goto :no-vswhere 16set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 17set VSWHERE_PRP=-property installationPath 18set VSWHERE_LMT=-version %1 19vswhere -prerelease > nul 20if not errorlevel 1 if "%VSWHERE_WITH_PRERELEASE%"=="1" set "VSWHERE_LMT=%VSWHERE_LMT% -prerelease" 21SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT% 22for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do ( 23 endlocal 24 set "VCINSTALLDIR=%%i\VC\" 25 set "VS150COMNTOOLS=%%i\Common7\Tools\" 26 exit /B 0 27) 28 29:no-vswhere 30endlocal 31exit /B 1 32