Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows SDK environment and powershell

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?).

like image 288
Voo Avatar asked Aug 07 '13 22:08

Voo


2 Answers

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

like image 124
x0n Avatar answered Sep 30 '22 14:09

x0n


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
like image 20
mikekol Avatar answered Sep 30 '22 14:09

mikekol