Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run task in another terminal with vscode integrated terminal

My problem is default integrated terminal in vscode is different with tasks.json that needed.

so when I want to run command in tasks.json I having many trouble.

for example if you set default integrated terminal to wsl, and you want to run bat file in tasks.json like below, you got a some error and task does not working.

"tasks": [
    {
        "label": "build",
        "type": "shell",
        "command": "build.bat",
        "args": [],
        "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": true,
            "panel": "shared",
            "showReuseMessage": true,
            "clear": false
        }
    }
]
like image 674
sorosh_sabz Avatar asked Nov 04 '25 13:11

sorosh_sabz


1 Answers

As you can see in vscode documents for tasks, one section is about common questions that say something like below

Can a task use a different shell than the one specified for the Integrated Terminal?

and answer this question is yes with below details

You can override a task's shell with the options.shell property. You can set this per task, globally, or per platform. For example, to use cmd.exe on Windows, your tasks.json would include:

{
    "version": "2.0.0",
    "windows": {
        "options": {
            "shell": {
                "executable": "cmd.exe",
                "args": [
                    "/d", "/c"
                ]
            }
        }
    },
    ...
like image 99
sorosh_sabz Avatar answered Nov 06 '25 04:11

sorosh_sabz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!