Use PowerShell for Visual Studio Command Prompt

前端 未结 5 1393
故里飘歌
故里飘歌 2021-01-30 23:33

In a serious intiative to migrate all my command line operations to PowerShell, I would like to avoid using the old fashioned command console for anything. However, the Visual

5条回答
  •  臣服心动
    2021-01-31 00:07

    I use this script that I call Initialize-VisualStudio.ps1, i call it in my profile with dot source, to set the environment variables need it, in my actual session:

    param([switch]$ArquitectureX86)
    if($ArquitectureX86)
    { $arq= "x86"}
    else
    { $arq="x64"}
    pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
    cmd /c "vcvarsall.bat $arq&set" |
    foreach {
      if ($_ -match "=") {
      $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"; 
    }
    }
    popd
    

提交回复
热议问题