我在 Windows 10 上,我在 vscode 中的默认 shell 是 git bash,它被所有任务使用。
对于特定任务,我想使用 powershell。这可能吗
{
"label": "sometask",
"type": "shell",
"command": "sam build",
"group": "test"
}
我在 Windows 10 上,我在 vscode 中的默认 shell 是 git bash,它被所有任务使用。
对于特定任务,我想使用 powershell。这可能吗
{
"label": "sometask",
"type": "shell",
"command": "sam build",
"group": "test"
}
对于以下工作。
https://code.visualstudio.com/docs/editor/tasks#_common-questions
{
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/d", "/c"
]
}
}
},
...
如何配置 VSCode 任务以在集成终端中运行 PowerShell 脚本
在集成终端 Visual Studio Code 上运行代码
特性 为了使用这个应用程序,在你的 .vscode 目录中创建一个配置文件。该文件将定义可用的任务。
例如,它可能看起来像:
{
"Task Name": {
"cmd": "ps", // The command you'd like to run in the terminal
"args": ["-a"], // Array of string arguments to the command
"stealFocus": true, // If this is true, focus will jump to the terminal right away
"shellOptions": {} // This allows you to override the default shell options described below for this specific task.
},
"Task 2:" {
"cmd": { // cmd and args can also vary based on platform, just like default shell.
"default": "vi",
"mac": "nano",
"linux": "emacs"
},
"args": {
"default": []
"mac": ["-B"]
}
}
}