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

前端 未结 17 1847
爱一瞬间的悲伤
爱一瞬间的悲伤 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:38

    I tried the above answers as of vscode 1.42.1 and they worked inasmuch as to get me a git bash terminal. So, bottom line this setting works just for opening a bash shell from terminal:

    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
    

    However it has the unwanted side effect of also being the shell used to build things and that breaks the MS C++ chain because the \ character used for path separator is understood by bash as an escape character. The complete fix for me then required me to add this extra variable, setting it to powershell:

    "terminal.integrated.automationShell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
    

    Now, I can have my bash terminal and Ctrl-Shift-B or F5 work without problems.

    Oh, and as other posters mentioned, the source for this information is VSCode's documentation.

提交回复
热议问题