我试图在Windows 11上用更新的Powershell 7替换默认的Powershell 5。
互联网上99%的解决方案说要把这个添加到settings.json中。
"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"但是,这现在给出了一条红色的、带有以下信息的行:
这是不可取的,配置默认shell的新方法是在
#terminal.integrated.profiles.windows#中创建终端配置文件,并将其配置文件名设置为#terminal.integrated.defaultProfile.windows#中的默认配置文件名。目前,这将优先于新的配置文件设置,但这将在未来发生变化。
有一个可能相关线程,但它只处理将其默认为本机Command Prompt,而不是将内容重新编排到Powershell 7。
那么,提供Powershell 7到VS代码的路径并将其设置为默认终端的正确新方法是什么?
发布于 2022-09-25 17:32:20
在早期的VSCode (Visual )版本中,"terminal.integrated.shell.*"和"terminal.integrated.shellArgs.*"设置确定了集成终端的默认外壳及其启动参数。
通过壳属性定义的"terminal.integrated.profiles.*"属性和包含默认要使用的配置文件名称的关联"terminal.integrated.defaultProfile.*"属性取代了这些属性,如下所示(使用命令面板中的> Preferences: Open Settings (JSON)打开settings.json文件):
"terminal.integrated.profiles.windows": {
"PowerShell_7": {
"source": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"icon": "terminal-powershell"
}, // ...
}
// Make the profile defined above the default profile.
"terminal.integrated.defaultProfile.windows": "PowerShell_7" 注意:
https://stackoverflow.com/questions/73845252
复制相似问题