You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code修改默认终端为CMD后调试Azure Function分隔符错误

我在Visual Studio Code中将默认终端修改为Command Prompt,调试Azure Function时会执行如下命令:

执行任务: .venv\Scripts\activate ; func host start <

但CMD的命令分隔符应为&&而非;,否则func host start命令无法正常执行,正确命令应为:

执行任务: .venv\Scripts\activate && func host start <

按常理该配置应自动识别,请问是否有方法手动修改该分隔符?

我的settings.json配置如下:

{
    "terminal.integrated.automationShell.windows": "C:\\windows\\System32\\cmd.exe",
    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "C:\\windows\\System32\\cmd.exe": {
            "path": "C:\\windows\\System32\\cmd.exe",
            "args": [],
            "icon": "terminal-cmd"
        },
        "JavaScript Debug Terminal": {
            "extensionIdentifier": "ms-vscode.js-debug",
            "icon": "debug",
            "id": "extension.js-debug.debugTerminal",
            "title": "JavaScript Debug Terminal"
        }
    }
}

解决方案

通过修改tasks.json即可自定义命令分隔符,配置示例如下:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cmd host start",
            "type": "shell",
            "dependsOn": "pip install (functions)",
            "windows": {
              "command": "${config:azureFunctions.pythonVenv}\\Scripts\\activate && func host start"
            },
            "isBackground": true,
            "problemMatcher": "$func-python-watch",
          },
        {
            "label": "pip install (functions)",
            "type": "shell",
            "osx": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "windows": {
                "command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
            },
            "linux": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "problemMatcher": []
        }
    ]
}

修改完成后,在launch.json中将preLaunchTask参数设置为cmd host start即可。

内容的提问来源于stack exchange,提问作者avaTMO

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 23:12:03