Created
May 19, 2014 08:37
-
-
Save Stephanvs/a540003a2fdd194b1ac0 to your computer and use it in GitHub Desktop.
PowerShell Profile
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
Set-Location $env:userprofile\Source | |
# Load posh-git example profile | |
. 'C:\tools\poshgit\dahlbyk-posh-git-c481e5b\profile.example.ps1' | |
function Set-VsCmd | |
{ | |
param( | |
[parameter(Mandatory, HelpMessage="Enter VS version as 2010, 2012, or 2013")] | |
[ValidateSet(2010,2012,2013)] | |
[int]$version | |
) | |
$VS_VERSION = @{ 2010 = "10.0"; 2012 = "11.0"; 2013 = "12.0" } | |
$targetDir = "c:\Program Files (x86)\Microsoft Visual Studio $($VS_VERSION[$version])\VC" | |
if (!(Test-Path (Join-Path $targetDir "vcvarsall.bat"))) { | |
"Error: Visual Studio $version not installed" | |
return | |
} | |
pushd $targetDir | |
cmd /c "vcvarsall.bat&set" | | |
foreach { | |
if ($_ -match "(.*?)=(.*)") { | |
Set-Item -force -path "ENV:\$($matches[1])" -value "$($matches[2])" | |
} | |
} | |
popd | |
write-host "`nVisual Studio $version Command Prompt variables set." -ForegroundColor Yellow | |
} | |
Set-VsCmd 2013 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment