VSCode Multiple Integrated Terminals!

Friday, 09 December 2016
  • By
  • Jeff Ammons
  • Tags:
  • Programming
  • VSCode
  • Tools
  • Tips
  • Microsoft

Two Terminals!

Both PowerShell and Bash in VS Code at the same time!

If you love Visual Studio Code as much as I do, and you do anything at the command line, you have probably discovered the integrated terminal.

Of course VS Code isn't the first text editor to include an integrated terminal, but it is extraordinarily handy!

The one complaint I've had has been that although I can have multiple terminal instances open and I could configure Code to use either PowerShell or Bash, I couldn't mix or match them.

In other words I could start PowerShell terminals or Bash terminals, but not one of each for instance.

Well, guess what?

I found a workaround!

You specify which you want in the User Preferences, which is really just a settings.json file.

For instance to configure PowerShell I add this to the file:

"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"

If I want Bash, I add this instead:

"terminal.integrated.shell.windows2": "C:\\Windows\\sysnative\\bash.exe"

So how do I get them to co-exist?

It's a hacky workaround for now, but when I click the plus sign to create a new terminal instance, it reads the settings.json file to see which terminal to launch.

Since that's the case all I have to do is add this to my file:

"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
"terminal.integrated.shell.windows2": "C:\\Windows\\sysnative\\bash.exe"

See what I did there? Since Code is looking for terminal.integrated.shell.windows and not windows2 it ignores the second one.

I launch my first terminal and get PowerShell.

Next I change the settings file so that PowerShell is “windows2” and Bash is “windows” then launch the second terminal.

Voila!

Now I have one of each and can happily swap between them!

Hopefully Code will gain the ability to let me specify which I want. It should be pretty easy to have a collection of shells and then let the user pick in the way ConEMU does.

I'm sure I'm not the first to figure this out, but man oh man is it useful!