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

12,697

Solution 1

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

Solution 2

No need to keep changing your default terminal setting. Install the Shell Launcher extension, configure it, and then ctrl-shift-t to select which terminal you want to open inside of VS Code.

Screenshot of Shell Launcher and settings

Solution 3

In recent version (1.15.0) you can

  • change the settings, then run the terminal, you've set
  • then change the settings again and run the another type of terminal by pressing the + sign
  • and so on...

You can put this in your settings file, and uncomment which one you need.

// 64-bit cmd if available, otherwise 32-bit
//"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
//"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
//"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
Share:
12,697

Related videos on Youtube

RBT
Author by

RBT

More details about me here. My blogging profile is here.

Updated on July 04, 2022

Comments

  • RBT
    RBT almost 2 years

    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?

  • RBT
    RBT almost 7 years
    Ohh..interesting. In fact your suggestion is working in pretty older versions of VS code as well e.g. 1.9. I tested it just now. I always thought it is a single configuration and I never bothered to click the + sign just after changing the configuration. Instead, I used to restart Visual Studio code to see the configuration changes to take effect in the terminal. Wonderful answer!
  • Sivaram K
    Sivaram K about 4 years
    On Windows (VS Code version - 1.45.1), I noticed that the Name of the command shell is itself a command to switch the current command shell to the target command shell seems to be switching among all 3 standard command shells (i.e. cmd, powershell, bash) only when the bash is set as default shell otherwise it only switches between cmd and powershell but not to the bash with the following error 'bash' is not recognized.