Friday, February 18, 2022

[SOLVED] How to select a different type of command shell in the Visual Studio Code integrated terminal

Issue

I looked at this link which talks about changing the default command shell in the integrated terminal of Visual Studio Code. I was successfully able to change it to Git Bash using the below setting in the settings.json file. You can open the settings.json file by pressing the Ctrl + , key combination or menu FilePreferencesSettings menu:

{
   "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}

There is a + sign in the integrated terminal with the help of which you can have multiple terminals running parallelly as shown in the screenshot below:

Enter image description here

I want to load a Git Bash shell in terminal # 1, Windows PowerShell in terminal # 2, etc. What is the relevant configuration to achieve the same?


Solution

As of June 17 '2018, things have become really smooth in Visual Studio Code when it comes to changing the integrated command shell. I'm enlisting all the options here:

  1. Select a different command shell on the go - Name of the command shell is itself a command to switch the current command shell to the target command shell. For example, let's say my integrated command shell is currently showing Bash, and I want to switch to PowerShell right away. Then type the command powershell, press Enter and the command shell changes to PowerShell. Similarly it works for all other types of command shells installed in your product.
  2. More instances of command shell - Just press Ctrl + Shift + `(back-tick). Every time you press the keyboard shortcut combination, a new instance of the command shell will get added.
  3. Change the configuration of default command shell type - Press F1 in Visual Studio Code and type or select Terminal: Select Default Shell as shown in the snapshot below.

Terminal Selection

Once selected, then choose the default command shell of your choice to change the settings permanently:

Terminal Selection



Answered By - RBT
Answer Checked By - Candace Johnson (WPSolving Volunteer)