通过任务2.0.0在外部终端启动vscode任务

时间:2017-12-27 14:09:03

标签: windows visual-studio-code vscode-tasks

是否可以通过外部终端启动bat文件,而不是在vscode终端内启动?

任务示例:

{
    "label": "Build",
    "type": "shell",
    "command": "./build.bat",
    "presentation": {
        "reveal": "always",
        "panel": "new"
    },
    "problemMatcher": [],
    "group": {
        "kind": "build",
        "isDefault": true
    }
}

1 个答案:

答案 0 :(得分:2)

tasks.json版本2.0.0编辑:

{
    "label": "%name%",
    "type": "shell",
    "command": "Start-Process -FilePath \"%path to bat%\"",
    "presentation": {
        "reveal": "never"
    },
    "problemMatcher": [],
    "group": {
        "kind": "build",
        "isDefault": true
    }
},

对于较旧的tasks.json版本: 因此,虽然vscode在Windows上使用PowerShell作为主要环境,但下一篇文章对我有用:

"command": "Start-Process -FilePath \"path to script\"",
"presentation": {
    "reveal": "never"
},