If you really want to do this from your "home" PowerShell prompt, the approach you show is the way to go. The simplest option is to run the VS 2010 command prompt and then start PowerShell.exe. Write-Host "`nVisual Studio 2022 Command Prompt variables set." -ForegroundColor Yellow ![]() pushd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools" Minor Changes for Visual Studio 2022, now that it's 64-bit. You can also make the split create just two items to avoid breaking values including the equal sign, which is also the separator of the environment variable name and the value: $v = $_.split("=", 2) set-item -force -path "ENV:\$($v)" -value Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools" The exact path may vary depending on which edition of Visual Studio 2017 you're using. vsvars32.bat appears to have been dropped in favor of VsDevCmd.bat. Things have changed yet again for Visual Studio 2017. ![]() Write-host "`nVisual Studio 2015 Command Prompt variables set." -ForegroundColor Yellow pushd 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools' Instead, you can use the vsvars32.bat file, which is located in the Common7\Tools folder. This has worked well for years - until Visual Studio 2015. Write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC' I added the following to my profile.ps1 file and all is well with the world. ![]() Stealing liberally from blog post Replace Visual Studio Command Prompt with PowerShell, I was able to get this to work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |