Skip to content

Instantly share code, notes, and snippets.

@mika76
Forked from AndyPook/profile.ps1
Created October 8, 2018 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mika76/b96c4d0b2a1e29b2fd1cdad726210248 to your computer and use it in GitHub Desktop.
Save mika76/b96c4d0b2a1e29b2fd1cdad726210248 to your computer and use it in GitHub Desktop.
powershell script to import VisualStudio environment variables
# Set environment variables for Visual Studio Command Prompt
# Based on: http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-2010-command-prompt
$version=14
pushd "c:\Program Files (x86)\Microsoft Visual Studio ${version}.0\Common7\Tools"
cmd /c "vsvars32.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=")
set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVS${version} Command Prompt variables set." -ForegroundColor Yellow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment