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

Vag*_*tAI 5 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
    }
}
Run Code Online (Sandbox Code Playgroud)

Vag*_*tAI 3

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
    }
},
Run Code Online (Sandbox Code Playgroud)

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

"command": "Start-Process -FilePath \"path to script\"",
"presentation": {
    "reveal": "never"
},
Run Code Online (Sandbox Code Playgroud)