Call vcvars from bash script

I need to call vcvars32.bat and vcvars64.bat from the same bash script (msys) that builds a different version of my application.

The problem is that even if I can call the batch files using the cmd.exe command, as soon as it returns, the Visual Studio variables are obviously not set.

I cannot call vcvars from an external batch file (for example, msys.bat), which calls a bash script, since I need the same script to call both of them sequentially.

So, is there a way to call vcvars to set the variables correctly in the bash script at runtime?

+4
source share
1 answer

What you need to do is use the command: β€œcall” in your batch script. Therefore, it may look something like this:

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" echo DevEnvDir set to: %DevEnvDir% 

If you do not use the "call", then the script will exit after vcvars32.bat exits and will not run any other command.

+1
source

All Articles