I am trying all kinds of variants of the following command:
powershell -command "'C:\Program Files (x86)\Microsoft Visual Studio 10.0\vc\vcvarsall.bat' x86" -noexit
I am hoping to run Powershell with the VS environment vars – to no avail. I just cannot get the quotes right.
Have a look at the PowerShell Community Extensions. It comes with a command to invoke a batch file, “remember” what env vars it set and bring those into your PowerShell session. In fact, my profile does just this with the VS vars e.g.:
The important command is the Invoke-BatchFile. The source to this function comes in the download so if you don’t want to use the whole module, you can copy out just that one function if you’d like.