Skip to content

Instantly share code, notes, and snippets.

@RushOnline
Forked from sqeezy/README.md
Created February 15, 2021 22:40
Show Gist options
  • Save RushOnline/162cd781ed415a223915ae6f4fd9d961 to your computer and use it in GitHub Desktop.
Save RushOnline/162cd781ed415a223915ae6f4fd9d961 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