Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The simplest option is to run the VS 2010 command prompt and then start PowerShell.exe. If you really want to do this from your "home" PowerShell prompt, the approach you show is the way to go. I use a script that Lee Holmes wrote a while back:</p> <pre><code>&lt;# .SYNOPSIS Invokes the specified batch file and retains any environment variable changes it makes. .DESCRIPTION Invoke the specified batch file (and parameters), but also propagate any environment variable changes back to the PowerShell environment that called it. .PARAMETER Path Path to a .bat or .cmd file. .PARAMETER Parameters Parameters to pass to the batch file. .EXAMPLE C:\PS&gt; Invoke-BatchFile "$env:VS90COMNTOOLS\..\..\vc\vcvarsall.bat" Invokes the vcvarsall.bat file to set up a 32-bit dev environment. All environment variable changes it makes will be propagated to the current PowerShell session. .EXAMPLE C:\PS&gt; Invoke-BatchFile "$env:VS90COMNTOOLS\..\..\vc\vcvarsall.bat" amd64 Invokes the vcvarsall.bat file to set up a 64-bit dev environment. All environment variable changes it makes will be propagated to the current PowerShell session. .NOTES Author: Lee Holmes #&gt; function Invoke-BatchFile { param([string]$Path, [string]$Parameters) $tempFile = [IO.Path]::GetTempFileName() ## Store the output of cmd.exe. We also ask cmd.exe to output ## the environment table after the batch file completes cmd.exe /c " `"$Path`" $Parameters &amp;&amp; set &gt; `"$tempFile`" " ## Go through the environment variables in the temp file. ## For each of them, set the variable in our local environment. Get-Content $tempFile | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } } Remove-Item $tempFile } </code></pre> <p>Note: this function will be available in the <a href="http://pscx.codeplex.com" rel="noreferrer">PowerShell Community Extensions</a> 2.0 module-based release coming soon.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload