Wednesday, August 11, 2010

Visual Studio command prompt with Powershell

I updated my profile in .\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 to include VS2010 prompt:


function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}

#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow

No comments: