首页 > 解决方案 > 如何仅在 vscode 中在 powershell 中运行特定任务

问题描述

我在 Windows 10 上,我在 vscode 中的默认 shell 是 git bash,它被所有任务使用。

对于特定任务,我想使用 powershell。这可能吗

        {
            "label": "sometask",
            "type": "shell",
            "command": "sam build",
            "group": "test"
        }

标签: powershellvisual-studio-codevssettings

解决方案


对于以下工作。

https://code.visualstudio.com/docs/editor/tasks#_common-questions

{
"version": "2.0.0",
"windows": {
    "options": {
        "shell": {
            "executable": "cmd.exe",
            "args": [
                "/d", "/c"
            ]
        }
    }
},
...

推荐阅读