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

前端 未结 17 1794
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 00:28

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?

17条回答
  •  有刺的猬
    2020-11-28 00:53


    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 -

提交回复
热议问题