修改 VSCode 默认 Shell 为 Powershell7
首先,我们的 VSCode 默认的 Shell(Terminal) 应该是这个:
然后,我们访问它给的网址https://aka.ms/PSWindows,去下载最新的 PowerShell,
这里推荐使用 MSI 包来安装,下载好之后,直接双击安装即可。
然后,Ctrl + Shift + P
,输入
open settings
,打开 settings.json
:
然后添加如下配置:
"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"
},
"PowerShell7": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"args": [],
"icon": "terminal-powershell"
}
},
"terminal.integrated.defaultProfile.windows": "PowerShell7",
然后,我们新建一个 Terminal 来看一下,
发现配置已经生效。
参考:
1. https://stackoverflow.com/questions/65908987/vs-code-how-to-open-settings-json-file
修改 VSCode 默认 Shell 为 Powershell7
http://fanyfull.github.io/2021/11/26/修改-VSCode-默认-Shell-为-Powershell7/