Search code examples
windowsvisual-studio-codevscode-tasks

Launch vscode task in external terminal via tasks 2.0.0


Is it possible to launch bat file via external terminal, not inside a vscode terminal?

Task sample:

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

Solution

  • tasks.json version 2.0.0 edit:

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

    For older tasks.json version: So, while vscode uses PowerShell as main environment on windows, next piece worked for me:

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