如何永久设置Visual Studio Code默认启动终端
VS Code启动默认加载Bash设置方法
- 打开VS Code设置界面:按下快捷键
Ctrl+,(Windows/Linux)或Cmd+,(Mac)快速唤起 - 顶部搜索框输入对应系统的默认终端配置项:
- Windows系统输入
terminal.integrated.defaultProfile.windows - Mac系统输入
terminal.integrated.defaultProfile.osx - Linux系统输入
terminal.integrated.defaultProfile.linux
- Windows系统输入
- 在「终端 > 集成 > 默认配置文件」的下拉选项中选中
Bash作为默认值 - 若修改后启动还是加载PowerShell,大概率是终端会话持久化导致的:搜索
terminal.integrated.persistSession,取消勾选该选项,关闭VS Code恢复上次终端会话的特性 - 如上述操作仍无效,可以手动编辑JSON配置文件:按下
Ctrl+Shift+P(Windows/Linux)或Cmd+Shift+P(Mac)唤起命令面板,输入「首选项:打开设置(JSON)」,添加对应配置:
示例(Windows Git Bash):
请将path值替换为你设备上Bash执行文件的实际存储路径"terminal.integrated.defaultProfile.windows": "Git Bash", "terminal.integrated.profiles.windows": { "Git Bash": { "path": "C:\\Program Files\\Git\\bin\\bash.exe", "args": [] } } - 保存配置后重启VS Code即可生效
内容的提问来源于stack exchange,提问作者Reis
相关产品推荐
相关产品推荐

