Switch Git Bash Command Prompt and Powershell in Visual Studio Code

Switch Git Bash Command Prompt and Powershell in Visual Studio Code

How do I use Bash on Windows from the Visual Studio Code integrated terminal?

You no longer need to type in bash.exe path manually. This answer is deprecated. Now you can switch to bash directly. Just make sure you have git installed.

Install Git from https://git-scm.com/download/win.

Then open the Visual Studio Code and open the command palette using Ctrl + Shift + P. Then type "open user setting", and then select "Open User Settings" from the drop-down menu.

Visual Studio Code command palate

Then this tab will open up with default settings on the left and your settings on the right:

enter image description here

Now copy this line of code to your own settings page (the pane on the right-hand side) and save - "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

Note: "C:\\Program Files\Git\bin\bash.exe" is the path where the bash.exe the file is located from the Git installation. If you are using the Windows Subsystem for Linux (WSL) Bash shell, the path would be "C:\Windows\System32\bash.exe"

Now press Ctrl + ` to open up the terminal from Visual Studio Code. And you will have Bash -

Enter image description here

  1. Install Git from https://git-scm.com/download/win

  2. Open Visual Studio Code and press and hold Ctrl + ` to open the terminal.

    Enter image description here

  3. Open the command palette using Ctrl + Shift + P.

  4. Type - Select Default Shell

  5. Select Git Bash from the options

  6. Click on the + icon in the terminal window

  7. The new terminal now will be a Git Bash terminal. Give it a few seconds to load Git Bash

    Enter image description here

  8. You can now toggle between the different terminals as well from the dropdown in the terminal.

    Enter image description here

For me, the following is the only combination that works!

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [

With git-bash.exe as the ...shell.windows, every time Bash was opening outside Visual Studio!! Updated: Newer versions of Visual Studio Code have the Select Default Shell command in the terminal pull-down menu:

Select Default Shell option

Remember that it just lists the shells that are in your %PATH% environment variable. For shells that aren't in your path, see other answers.

Extra tip: when you start bash it will just execute if you have initialization commands in .bash_profile you must copy it to .bashrc. It's essential for using the Conda environment in Git Bash.

Before version 1.36 (June 2019)

The easiest way now (at least from Visual Studio Code 1.22 on) is to type Shift + Ctrl + P to open the Command Palette and type:

Select Default Shell

Now you can easily select your preferred shell between the ones found in your path:

Shell selection list

For shells that aren't in your %PATH%, see the other answers.

See the complete Visual Studio Code shell reference. There's a lot of meaty stuff.

Things have been a little bit changed due to the latest updates on the Visual Studio Code. The following steps work for me.

  1. Press Ctrl + Shift + P to open the Visual Studio Code command palate.

  2. Type >preferences: Open Settings (JSON) in the text area.

  3. Add the following lines at the end of the JSON file which is displayed in your right-hand pane.

    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
  4. Close and reopen your Visual Studio Code instance.

I followed this tutorial from Paul DeCarlo to use the Bash from the Windows Subsystem for Linux (WSL) instead of what comes with Git Bash for Windows. They are the same steps as above in the answer but use the below in your User Settings instead.

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


It depends on whether you have installed Git Bash in the current user only or all users:

If it is installed on all users then put "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe" in your User Settings (Ctrl + Comma).

If it is installed on only the current user then put "terminal.integrated.shell.windows": "C:\\Users\\<name of your user>\\AppData\\Local\\Programs\\Git\\bin\\bash.exe" in your User Settings (Ctrl + Comma).

If the methods listed above do not work then you should try Christer's solution which says -

If you want the integrated environment you need to point to the sh.exe file inside the bin folder of your Git installation.

So the configuration should say C:\\<my-git-install>\\bin\\sh.exe.

Note: The sh.exe and bash.exe appear completely the same to me. There should be no difference

This answer is similar to the top voted answer, but with an important distinction: a lot of the previous answers on this question focus on running Git Bash while my answer focuses on running WSL Bash.

  1. Enable Windows Subsystem for Linux on your Windows 10 machine.

  2. Open Visual Studio Code and press and hold Ctrl + ` to open the terminal.

  3. Open the command palette using Ctrl + Shift + P.

  4. Type - Select Default Shell.

  5. Select WSL Bash (NOT Git Bash) from the options.

enter image description here

  1. Click on the + the icon in the terminal window. The new terminal now will be a WSL Bash terminal!


Post a Comment