Skip to content

Instantly share code, notes, and snippets.

@mjul
Created December 16, 2015 09:35
Show Gist options
  • Save mjul/aad382b82ffaa88123a1 to your computer and use it in GitHub Desktop.
Save mjul/aad382b82ffaa88123a1 to your computer and use it in GitHub Desktop.
Add Visual Studio 2015 developer tools to the PowerShell path
#
# Set environment variables for Visual Studio Command Prompt
# The technique is to start a Developer Command Prompt and capture its environment into PowerShell
#
# (VS2013) http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt
# (VS2015) https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1
#
# Add this to your $PROFILE file in PowerShell
pushd 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\'
cmd /c "VsDevCmd.bat & set" |
foreach {
if($_-match"=") {
$v = $_.split("=");
set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "Visual 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