simpleroseinc

Logo

Developer Tips

View Company GitHub Profile

13 November 2020

Visual Studio command prompt in Windows Terminal

by Zhihao Yuan

Windows Terminal

Visual Studio 2019 comes with shortcuts that activate the environment for C++ build tools in the command line, such as “x64 Native Tools Command Prompt for VS 2019,” but these shortcuts launch cmd.exe. Here is how to add them to Windows Terminal.

First, click “Settings” in the menu, as shown in the screenshot above. You will then be able to edit the configuration JSON in Visual Studio. Add a new entry that looks like the following:

{
  "guid": "{034113a1-f2bc-44e4-acd2-6d5d94b890e6}",
  "name": "x64 Native Tools Command Prompt for VS 2019",
  "commandline": "%comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"",
  "startingDirectory": "%USERPROFILE%",
  "hidden": false,
  "icon": "ms-appdata:///roaming/DesktopDevCPP.png"
}

A few things to be aware of:

  1. Please replace the value of "guid" with a new one by running the [guid]::NewGuid() command in PowerShell.
  2. You can copy the “Target” field from a stock shortcut and put it in "commandline."
  3. URI ms-appdata:///roaming points to %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState.
tags: visual-studio - windows