Add Developer PowerShell and Developer Command Prompt for Visual Studio to Windows Terminal

Published Mar 29 2021 01:29 PM 18.5K Views

Windows Terminal is great, I use it for all my command line work. It automatically detects new shells that are installed on your system, like the shell for Ubuntu or PowerShell Core 7. Unfortunately, it doesn't detect the Developer Command Prompt and Developer PowerShell for Visual Studio. Luckily, you can add them yourself!

image.png

The steps are rather simple:

  • Open Windows Terminal
  • Open the Settings through the UI (see screenshot) or with Ctrl+,
  • In the settings.json file that opens in your favorite code editor, locate the lists array inside the profiles object

image-1.png

Inside that lists array, you can add your additional profiles. In this case, for the Visual Studio command prompts, just use the following snippet:

 

 

            {
                "name": "Developer PowerShell for VS 2019",
                "commandline": "powershell.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationpath; Import-Module (Join-Path $vsPath 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation}\"",
                "icon": "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png"
            },
            {
                "name": "Developer Command Prompt for VS 2019",
                "commandline": "%comspec%  /k \"%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat\"",
                "icon": "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png"
            },

 

 

Save the settings.json file, and now the new options show when opening a new tab:

image-2.png

Time to do your Visual Studio command line work in the fancy new Windows Terminal!

4 Comments
Senior Member

The Developer PowerShell for VS installed with Visual Studio 2019 is the x86 Windows PowerShell.

Occasional Visitor

Thank you!

Just replace "Enterprise" by "Community", depending on your version of VS2019.

Occasional Visitor

If you have more than one edition of Visual Studio 2019 installed you'll need to add `| Where { $_ -like '*editionName*'` to the PowerShell section. I hope this formats OK, Edge isn't showing anything when I preview it.

 

 
{
    "name": "Developer PowerShell for VS 2019",
    "commandline": "powershell.exe -noe -c \"&{$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\\Microsoft Visual Studio\\Installer\\vswhere.exe') -property installationPath | Where { $_ -like '*enterprise*' }; Import-Module (Join-Path $vsPath 'Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll'); Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation}\"",
    "icon": "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\Assets\\VisualStudio.70x70.contrast-standard_scale-180.png"
},


Frequent Visitor

To get x64 Developer Powershell running on my x64 machine, I have this modification in my settings.json

Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64";
%3CLINGO-SUB%20id%3D%22lingo-sub-2243078%22%20slang%3D%22en-US%22%3EAdd%20Developer%20PowerShell%20and%20Developer%20Command%20Prompt%20for%20Visual%20Studio%20to%20Windows%20Terminal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2243078%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fp%2Fwindows-terminal%2F9n0dx20hk701%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWindows%20Terminal%3C%2FA%3E%20is%20great%2C%20I%20use%20it%20for%20all%20my%20command%20line%20work.%20It%20automatically%20detects%20new%20shells%20that%20are%20installed%20on%20your%20system%2C%20like%20the%20shell%20for%20Ubuntu%20or%20PowerShell%20Core%207.%20Unfortunately%2C%20it%20doesn't%20detect%20the%20Developer%20Command%20Prompt%20and%20Developer%20PowerShell%20for%20Visual%20Studio.%20Luckily%2C%20you%20can%20add%20them%20yourself!%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F268024iC95110B8CF64A29D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20steps%20are%20rather%20simple%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOpen%20Windows%20Terminal%3C%2FLI%3E%0A%3CLI%3EOpen%20the%20Settings%20through%20the%20UI%20(see%20screenshot)%20or%20with%20Ctrl%2B%2C%3C%2FLI%3E%0A%3CLI%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Esettings.json%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20that%20opens%20in%20your%20favorite%20code%20editor%2C%20locate%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Elists%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Earray%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eprofiles%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image-1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F268025i0ADDAE246588CC84%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image-1.png%22%20alt%3D%22image-1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EInside%20that%3CCODE%3Elists%3C%2FCODE%3Earray%2C%20you%20can%20add%20your%20additional%20profiles.%20In%20this%20case%2C%20for%20the%20Visual%20Studio%20command%20prompts%2C%20just%20use%20the%20following%20snippet%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22Developer%20PowerShell%20for%20VS%202019%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22commandline%22%3A%20%22powershell.exe%20-noe%20-c%20%5C%22%26amp%3B%7B%24vsPath%20%3D%20%26amp%3B(Join-Path%20%24%7Benv%3AProgramFiles(x86)%7D%20'%5C%5CMicrosoft%20Visual%20Studio%5C%5CInstaller%5C%5Cvswhere.exe')%20-property%20installationpath%3B%20Import-Module%20(Join-Path%20%24vsPath%20'Common7%5C%5CTools%5C%5CMicrosoft.VisualStudio.DevShell.dll')%3B%20Enter-VsDevShell%20-VsInstallPath%20%24vsPath%20-SkipAutomaticLocation%7D%5C%22%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22icon%22%3A%20%22%25ProgramFiles(x86)%25%5C%5CMicrosoft%20Visual%20Studio%5C%5C2019%5C%5CEnterprise%5C%5CCommon7%5C%5CIDE%5C%5CAssets%5C%5CVisualStudio.70x70.contrast-standard_scale-180.png%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22Developer%20Command%20Prompt%20for%20VS%202019%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22commandline%22%3A%20%22%25comspec%25%20%20%2Fk%20%5C%22%25ProgramFiles(x86)%25%5C%5CMicrosoft%20Visual%20Studio%5C%5C2019%5C%5CEnterprise%5C%5CCommon7%5C%5CTools%5C%5CVsDevCmd.bat%5C%22%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22icon%22%3A%20%22%25ProgramFiles(x86)%25%5C%5CMicrosoft%20Visual%20Studio%5C%5C2019%5C%5CEnterprise%5C%5CCommon7%5C%5CIDE%5C%5CAssets%5C%5CVisualStudio.70x70.contrast-standard_scale-180.png%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESave%20the%3CCODE%3Esettings.json%3C%2FCODE%3Efile%2C%20and%20now%20the%20new%20options%20show%20when%20opening%20a%20new%20tab%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image-2.png%22%20style%3D%22width%3A%20614px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F268026i4B926E8F52662098%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image-2.png%22%20alt%3D%22image-2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETime%20to%20do%20your%20Visual%20Studio%20command%20line%20work%20in%20the%20fancy%20new%20Windows%20Terminal!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2243078%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22post-full-custom-excerpt%22%3EAdd%20the%20Visual%20Studio%20command%20line%20tools%20as%20a%20separate%20profile%20to%20Windows%20Terminal.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2243078%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHow%20to%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2244048%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20Developer%20PowerShell%20and%20Developer%20Command%20Prompt%20for%20Visual%20Studio%20to%20Windows%20Terminal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2244048%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Developer%20PowerShell%20for%20VS%20installed%20with%20Visual%20Studio%202019%20is%20the%20x86%20Windows%20PowerShell.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2244923%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20Developer%20PowerShell%20and%20Developer%20Command%20Prompt%20for%20Visual%20Studio%20to%20Windows%20Terminal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2244923%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you!%3C%2FP%3E%3CP%3EJust%20replace%20%22Enterprise%22%20by%20%22Community%22%2C%20depending%20on%20your%20version%20of%20VS2019.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2245077%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20Developer%20PowerShell%20and%20Developer%20Command%20Prompt%20for%20Visual%20Studio%20to%20Windows%20Terminal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2245077%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20have%20more%20than%20one%20edition%20of%20Visual%20Studio%202019%20installed%20you'll%20need%20to%20add%20%60%7C%20Where%20%7B%20%24_%20-like%20'*editionName*'%60%20to%20the%20PowerShell%20section.%20I%20hope%20this%20formats%20OK%2C%20Edge%20isn't%20showing%20anything%20when%20I%20preview%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%3E%7B%0A%26nbsp%3B%20%26nbsp%3B%20%22name%22%3A%26nbsp%3B%22Developer%26nbsp%3BPowerShell%26nbsp%3Bfor%26nbsp%3BVS%26nbsp%3B2019%22%2C%0A%26nbsp%3B%20%26nbsp%3B%20%22commandline%22%3A%26nbsp%3B%22powershell.exe%26nbsp%3B-noe%26nbsp%3B-c%26nbsp%3B%5C%22%26amp%3B%7B%24vsPath%26nbsp%3B%3D%26nbsp%3B%26amp%3B(Join-Path%26nbsp%3B%24%7Benv%3AProgramFiles(x86)%7D%26nbsp%3B'%5C%5CMicrosoft%26nbsp%3BVisual%26nbsp%3BStudio%5C%5CInstaller%5C%5Cvswhere.exe')%26nbsp%3B-property%26nbsp%3BinstallationPath%26nbsp%3B%7C%26nbsp%3BWhere%26nbsp%3B%7B%26nbsp%3B%24_%26nbsp%3B-like%26nbsp%3B'*enterprise*'%26nbsp%3B%7D%3B%26nbsp%3BImport-Module%26nbsp%3B(Join-Path%26nbsp%3B%24vsPath%26nbsp%3B'Common7%5C%5CTools%5C%5CMicrosoft.VisualStudio.DevShell.dll')%3B%26nbsp%3BEnter-VsDevShell%26nbsp%3B-VsInstallPath%26nbsp%3B%24vsPath%26nbsp%3B-SkipAutomaticLocation%7D%5C%22%22%2C%0A%20%20%20%20%22icon%22%3A%26nbsp%3B%22%25ProgramFiles(x86)%25%5C%5CMicrosoft%26nbsp%3BVisual%26nbsp%3BStudio%5C%5C2019%5C%5CEnterprise%5C%5CCommon7%5C%5CIDE%5C%5CAssets%5C%5CVisualStudio.70x70.contrast-standard_scale-180.png%22%0A%7D%2C%0A%0A%0A%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2247521%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20Developer%20PowerShell%20and%20Developer%20Command%20Prompt%20for%20Visual%20Studio%20to%20Windows%20Terminal%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2247521%22%20slang%3D%22en-US%22%3E%3CP%3ETo%20get%20x64%20Developer%20Powershell%20running%20on%20my%20x64%20machine%2C%20I%20have%20this%20modification%20in%20my%20settings.json%3C%2FP%3E%3CPRE%3EEnter-VsDevShell%20-VsInstallPath%20%24vsPath%20-SkipAutomaticLocation%20-DevCmdArguments%20%22-arch%3Dx64%20-host_arch%3Dx64%22%3B%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Mar 29 2021 01:27 PM
Updated by: