get_vsvars.bat 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. @REM @file
  2. @REM Windows batch file to find the Visual Studio set up script
  3. @REM
  4. @REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
  5. @REM This program and the accompanying materials
  6. @REM are licensed and made available under the terms and conditions of the BSD License
  7. @REM which accompanies this distribution. The full text of the license may be found at
  8. @REM http://opensource.org/licenses/bsd-license.php
  9. @REM
  10. @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  11. @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  12. @REM
  13. @echo off
  14. goto :main
  15. :set_vsvars
  16. for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
  17. if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
  18. )
  19. goto :EOF
  20. :read_vsvars
  21. @rem Do nothing if already found, otherwise call vsvars32.bat if there
  22. if defined VCINSTALLDIR goto :EOF
  23. set GET_VSVARS_BAT_CHECK_DIR=%*
  24. set GET_VSVARS_BAT_CHECK_DIR=%GET_VSVARS_BAT_CHECK_DIR:"=%
  25. if exist "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat" call "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat"
  26. :vsvars_done
  27. goto :EOF
  28. REM NOTE: This file will find the most recent Visual Studio installation
  29. REM apparent from the environment.
  30. REM To use an older version, modify your environment set up.
  31. REM (Or invoke the relevant vsvars32 file beforehand).
  32. :main
  33. if defined VCINSTALLDIR goto :done
  34. if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
  35. if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
  36. if defined VS140COMNTOOLS call :read_vsvars "%VS140COMNTOOLS%"
  37. if defined VS120COMNTOOLS call :read_vsvars "%VS120COMNTOOLS%"
  38. if defined VS110COMNTOOLS call :read_vsvars "%VS110COMNTOOLS%"
  39. if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
  40. if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
  41. if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"
  42. if defined VS71COMNTOOLS call :read_vsvars "%VS71COMNTOOLS%"
  43. :done
  44. set GET_VSVARS_BAT_CHECK_DIR=