-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathcpi.bat
More file actions
31 lines (27 loc) · 685 Bytes
/
cpi.bat
File metadata and controls
31 lines (27 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@echo off
set CWD=%~dp0
set VCVARSBAT=""
set VSVER=2022 2019 2017
set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
where cl.exe >NUL 2>&1
if ERRORLEVEL 1 (
if exist %VSWHERE% (
for %%v in (%VSVER%) do (
for /f "usebackq tokens=*" %%i in (`%VSWHERE% -find **\vcvarsall.bat`) do (
echo %%i | find "%%v" >NUL
if not ERRORLEVEL 1 (
set VCVARSBAT="%%i"
set VSVER=%%v
goto :break
)
)
)
)
:break
if exist %VCVARSBAT% (
echo Setting up environment for MSVC %VSVER% usage
call %VCVARSBAT% amd64 >NUL 2>&1
)
)
cd /D %CWD%
cpi.exe %*