I am attempting to build a large system through a python script. I first need to set up the environment for Visual Studio. Having problems I decided to see if I could just set up and launch Visual Studio. I first set several environment variables and then call C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat x64
.
Once this finishes I call devenv /useenv
. If I do these from the command prompt everything works fine and I can do what I need to do in VS. My python code for doing this is:
import os
vcdir=os.environ['ProgramFiles(x86)']
arch = 'x64'
command = 'CALL "' +vcdir+'\\Microsoft Visual Studio 11.0\\VC\\vcvarsall.bat" '+arch
os.system(command)
command = "CALL devenv /useenv"
os.system(command)
If I run this, the bat file will run and when it tries the devenv
command I get that it is not recognized. It looks like to bat file runs in a different subprocess than the one that the script is running in. I really need to get this running in my current process. My eventual goal is to do the entire build inside the python script and there will be many calls to devenv
to do a major portion of the build.
Thank you.