Using Visual Studio Developer prompt with PowerShell/PWSH

Pratik Chowdhury
2 min readNov 15, 2021

--

TL:DR

So you are probably thinking, wait a second, I can see that in my shortcuts, there is a PowerShell Command. And am using that, so why does your article need to even exist?

So why use this instead?

  1. Use PowerShell Core/7+ while shortcut uses Windows PowerShell 5.0 instead
  2. Use with your own custom PowerShell script which a shortcut won’t support
  3. Add to your own PowerShell profile which the existing shortcut cannot support
  4. Use x64 prompt instead of 32 bit prompts by default which the old shortcut does not support

At the end, the reasons are endless and all can be said are down to making your current workflow a lot more efficient.

Let’s do it

Default Installation directory

  1. VS 2019 this would be ${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Community
  2. For VS 2022 this would be $env:ProgramFiles\Microsoft Visual Studio\2022\Community for Visual Studio 2022 (Holy 64 bits Batman!).

Of course Community probably gets replaced by Enterprise in your case or Professional if you have licenses for those

Modifying PowerShell scripts

  1. Modify your PowerShell profile
  2. You can modify any PowerShell scripts.
    Maybe a ps1 script which opens a new custom profile in Windows Terminal or Windows shortcuts if that’s what you are into

Script to add

For default

Default 32 Bit compiler with logo

Use x64 instead

You would need to use the DevCmdArguments command instead with arch as x64

64 bit compiler with logo

Disable default logo

You would have to use the -no_logo command in DevCmdArguments.

No VS logo being shown

Special thanks to

  1. https://developercommunity.visualstudio.com/t/x64-developer-powershell-for-vs-2019/943058#T-N1062776

--

--

No responses yet