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

Mahade Walid picture Mahade Walid · Mar 5, 2017 · Viewed 372.4k times · Source

Visual Studio Code on Windows uses PowerShell by default as the integrated terminal. If you want to use Bash from Visual Studio Code, what steps should be followed?

Answer

Mahade Walid picture Mahade Walid · Mar 5, 2017

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 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 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 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