如何禁用VS Code默认集成终端配置文件,仅保留指定终端
在Windows 11的VS Code中只保留指定终端选项
在Windows 11上使用VS Code时,点击「新建终端」会列出所有检测到的Shell选项(比如PowerShell、WSL Ubuntu、Git Bash、命令提示符等)。如果想隐藏不需要的选项,仅保留PowerShell和Ubuntu,可以通过修改VS Code的配置文件实现。
我最初的终端配置如下:
"terminal.integrated.profiles.windows": { "pwsh": { "path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "args": ["-nologo"] } },
查了不少资料没找到解决办法,最后用以下配置搞定了问题:
"terminal.integrated.profiles.windows": { "PowerShell": null, "Git Bash": null, "Command Prompt": null, "Ubuntu-20.04 (WSL)": null, "JavaScript Debug Terminal": null, "Windows PowerShell": null, "pwsh": { "path": "pwsh.exe", "args": ["-nologo"], "name": "pwsh" }, "bash": { "path": ["C:\\WINDOWS\\System32\\bash.exe"], "name": "bash" } }, "terminal.integrated.defaultProfile.windows": "bash",
配置说明
- 将不需要的终端选项对应的配置值设为
null,即可让它们从新建终端的下拉列表中消失 - 保留需要的Shell配置(这里是PowerShell的
pwsh和Ubuntu的bash),路径和参数可根据实际情况调整 - 通过
terminal.integrated.defaultProfile.windows可以设置默认打开的终端类型
内容的提问来源于stack exchange,提问作者Peter Wagner Sandoval Moreno
相关产品推荐
相关产品推荐

