vscdoe的cmd终端配置失效问题
2025年5月18日大约 1 分钟
如下配置失效了
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
可以使用路径或源以及一组可选参数创建概要文件.这个源代码只在Windows上可用,可以用来让VS Code检测PowerShell或Git Bash的安装.或者可以使用直接指向shell可执行文件的路径。这里有一些配置文件的例子:

{
"terminal.integrated.profiles.windows": {
"PowerShell -NoProfile": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
},
"terminal.integrated.profiles.linux": {
"zsh (login)": {
"path": "zsh",
"args": ["-l"]
}
}
}
The default profile can be defined manually with the terminal.integrated.defaultProfile.* settings. This should be set to the name of an existing profile:
默认配置文件可以通过terminal.integrated.defaultProfile.* settings手工定义。这应该设置为现有配置文件的名称:
{
"terminal.integrated.profiles.windows": {
"my-pwsh": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
},
"terminal.integrated.defaultProfile.windows": "my-pwsh"
}
提示:集成的终端shell在VS Code的权限下运行。如果您需要以较高的(管理员)权限或不同的权限运行shell命令,请在终端中使用平台实用程序,如runas.exe。
实际最终配置
"terminal.integrated.profiles.windows": {
"ps": {
"source": "PowerShell",
"args": []
},
"bash": {
"path": "D:\\install\\software_isntall\\Git\\bin\\bash.exe",
"args": []
},
"cmd": {
"path": "C:\\Windows\\System32\\cmd.exe",
"args": []
},
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
也就是 三种都可用
注意"terminal.integrated.defaultProfile.windows": 只能设置 PowerShell,Command Prompt,JavaScript Debug Terminal
三个其中之一,无法设置其他名称,这点跟文档不一样