如何从Visual Studio代码运行Windows Bash作为运行任务?Windows Bash和Visual Studio代码:如何将bash作为运行任务启动?
以下是我在tasks.json
上做的一些尝试。
{
"version": "0.1.0",
"command": "cmd",
"isShellCommand": true,
"args": [ "RunShellScript.bat" ],
"showOutput": "always"
}
RunShellScript.bat只有这一行:bash myShellScript.sh
。如果你只是从开始打开cmd,并输入该行,它将执行。如果您只需双击该文件,它也可以完美运行。但是,从VSCode启动时,此输出只会挂起,直到我终止它。
尝试数2:
{
"version": "0.1.0",
"command": "cmd",
"isShellCommand": true,
"args": [ "bash myShellScript.sh" ],
"showOutput": "always"
}
这也挂起,就像以上。
尝试数3:
{
"version": "0.1.0",
"command": "C:/Windows/System32/bash",
"isShellCommand": false,
"args": [ "myShellScript.sh" ],
"showOutput": "always"
}
这给了我:
Failed to launch external program C:/Windows/System32/bash myShellScript.sh
spawn C:/Windows/System32/bash ENOENT
香港专业教育学院也尝试设置"isShellCommand"
变量真假在一些案件,但无济于事。
有谁知道如何做到这一点?
一个不太冒险的解决方案是尝试运行'C:\ Windows \ sysnative \ bash.exe'。 –
你能编辑你的文章以包含你使用过的tasks.json或launch.json吗? – atzero
我所谓的'解决方案',无论出于何种原因,都停止了工作......调查。 –