Skip to content

Instantly share code, notes, and snippets.

@Tetralux
Created January 11, 2022 03:01
Show Gist options
  • Save Tetralux/e839ce03a0c666a034688cf672d127e9 to your computer and use it in GitHub Desktop.
Save Tetralux/e839ce03a0c666a034688cf672d127e9 to your computer and use it in GitHub Desktop.
A simpler wrapper for vcvarsall.bat which only does the work on the first run
@echo off
:: Path to vcvarsall.bat from Visual Studio
:: When called, it makes cl.exe (C++ compiler) and link.exe (Linker) available in PATH.
set VCVARSPATH="C:\Program Files (x86)\Microsoft Visual Studio\VC\Auxiliary\Build\vcvarsall.bat"
if "%VSISSET%"=="" (
%VCVARSPATH% %*
if "%ERRORLEVEL%"=="0" (
set VSISSET=%*
) else (
echo [vcvars returned %ERRORLEVEL%; resetting]
)
) else (
echo [skipping vcvarsall; already set]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment