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?
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",
This worked for me the first time... which is rare for this stuff.
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.
Then this tab will open up with default settings on left and your settings on the right:
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 -
Latest VS code :
Ctrl+,
)edit in settings.json
. Click and add "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
Bash terminal will reflect on the terminal.
I had already set up lots of conda
environments on WSL
(Bash on Ubuntu on Windows), so I wanted to use the same Bash installation on Visual Studio Code.
To do that, I just had to specify the path of this particular Bash executable (instead of the Git-Bash
) on Visual Studio Code's settings:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
PS: to make sure where your Ubuntu on Bash executable is installed on your Windows machine, open the Command prompt
(search: cmd
) and run:
where bash.exe
I happen to be consulting for a Fortune 500 company and it's sadly Windows 7 and no administrator privileges. Thus Node.js, Npm, Visual Studio Code, etc.. were pushed to my machine - I cannot change a lot, etc...
For this computer running Windows 7:
Below are my new settings. The one not working is commented out.
{
"update.channel": "none",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
//"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
}