The windows v7.1 SDK has a SetEnv.Cmd
script in its binary folder to correctly setup its environment. The problem is this script obviously only works with cmd.exe
and I can't find an equivalent for powershell anywhere.
So am I forced to use cmd.exe or is there a way to use powershell (apart from manually rewriting the SetEnv.Cmd script - if even that would work?).
Someone wrote a ps1 script that parses out the SDK's setenv so you can avoid the extra processes:
http://www.tavaresstudios.com/Blog/post/The-last-vsvars32ps1-Ill-ever-need.aspx
You can launch an instance of CMD.EXE, run SetEnv.cmd, and then launch PowerShell from within the CMD window. The PowerShell instance that opens up will import the environment variables from the CMD instance that spawned it.
It's ugly, but it works.
I wrote a batch script to do it for me, and just created a shortcut to it on my desktop. Here's an example:
@echo off
call "C:\Path\To\SetEnv.cmd" param1 param2 param3
powershell.exe -noexit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With