14

I looked at this link which talks about changing the default command shell in the integrated terminal of Visual Studio Code. I was able to change it to Git Bash using the below setting in the settings.json file. You can open settings.json file by pressing the Ctrl + , or from 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, and so on. What is the relevant configuration to achieve it?

RBT
  • 24,161
  • 21
  • 159
  • 240
  • 1
    Please read https://stackoverflow.com/questions/43427631/how-to-add-multiple-terminal-in-vs-code/50890703#50890703 for answer your question. – AKS Jun 16 '18 at 18:55

5 Answers5

12

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

marchica
  • 2,326
  • 23
  • 21
7

As of June 17 '2018, things have become really smooth in Visual Studio (VS) 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. Then type powershell command and press Enter. The command shell will change to PowerShell. Similarly it works for all other types of command shells installed in VS Code.
  2. More instances of command shell - 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

RBT
  • 24,161
  • 21
  • 159
  • 240
  • 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`. – Sivaram Koduri May 29 '20 at 05:49
2

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"
Mattia72
  • 825
  • 1
  • 8
  • 23
  • 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! – RBT Aug 17 '17 at 09:31
0

enter image description here

Click on Arrow then click something like Select template profile so then , will Open the search bar automatically, so... change by your choice

RBT
  • 24,161
  • 21
  • 159
  • 240
0

Terminal profiles is what you are looking for - https://code.visualstudio.com/docs/terminal/profiles. It didn't exist by the time the question was posted and the only solution by that time was the somewhat limited "terimnal.integrated.terminal.xxx" solution.

Example configuration:

"terminal.integrated.profiles.windows": {
  "Cmd": {
    "path": "C:\\Windows\\System32\\cmd.exe",
    "icon": "terminal-cmd"
  },
  "GitBash": {
    "path": "C:\\Program Files\\Git\\bin\\bash.exe", "icon": "terminal-bash",
    "icon": "terminal-bash"
  },
  "PowerShell": {
    "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
    "icon": "terminal-powershell"
  },
},
brunoff
  • 4,161
  • 9
  • 10