Created
February 7, 2017 21:49
-
-
Save nschelin/90cc64b8a98461abe5c7e3377cac82bc to your computer and use it in GitHub Desktop.
PowerShell: Load Developer Command Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Visual Studio 2015 Developer Command Prompt in PowerShell | |
# credit: http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt | |
# path to scripts stored and loaded in profile | |
function LoadDevCmdPrompt() { | |
# store cwd and change path | |
pushd "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools" | |
# run batch file and each variable | |
cmd /c "VsDevCmd.bat&set" | | |
foreach{ | |
if($_ -match "=") { | |
$v = $_.split("="); | |
Set-Item -force -path "ENV:\$($v[0])" -value "$($v[1])" | |
} | |
} | |
# return to cwd | |
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