Skip to content

Instantly share code, notes, and snippets.

@sqeezy
Created October 10, 2018 09:17
Show Gist options
  • Save sqeezy/11863647662b42e3b66b70331156c490 to your computer and use it in GitHub Desktop.
Save sqeezy/11863647662b42e3b66b70331156c490 to your computer and use it in GitHub Desktop.
PowerShell script to have all variables from vcvars32.bat from Visual Studio

Taken from here for prosperity.

Put this in %USERDIR%/Documents/WindowsPowerShell/profile.ps1, run a PowerShell terminal and you should see the messages "Visual Studio 2015..." pop up.

# Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 14.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 "`nVisual Studio 2015 Command Prompt variables set." -ForegroundColor Yellow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment