【教程】vscode添加powershell7终端

  • win10自带的 powershell 是1.0版本的,太老了,更换为powershell7后,在 vscode 的集成终端中没有显示
  • 本篇教程记录在vscode添加powershell7终端的过程
  1. 打开vscode终端配置

  2. 然后来到这个页面进行设置

  3. 查看 powershell7 的安装位置,并关闭以管理员身份启动

  4. 寻找下面的设置(找得到就修改,找不到自己添加,路径填写自己的powershell路径)

  • terminal.external.windowsExec
json 复制代码
"terminal.external.windowsExec": "E:\\PowerShell\\7\\pwsh.exe"

说明: 指定在 Windows 上打开外部终端时使用的可执行文件路径。在这里,它指向 PowerShell 7 的可执行文件 (pwsh.exe)。

  • terminal.integrated.profiles.windows
json 复制代码
"terminal.integrated.profiles.windows": {
    "PowerShell 7": {
        "path": "E:\\PowerShell\\7\\pwsh.exe"
    }
}

说明: 定义集成终端的配置文件。在这里,创建了一个名为 "PowerShell 7" 的终端配置,指定其可执行文件路径为E:\\PowerShell\\7\\pwsh.exe。这使得用户可以在 VS Code 中选择使用 PowerShell 7 作为终端。

  • terminal.integrated.automationProfile.windows
json 复制代码
"terminal.integrated.automationProfile.windows": {
    "path": "E:\\PowerShell\\7\\pwsh.exe"
}

说明: 指定在自动化任务(如调试或 CI/CD)中使用的终端配置文件。在这里,设置为 PowerShell 7 的路径,以便在自动化场景中使用。

  • terminal.integrated.defaultProfile.windows
json 复制代码
"terminal.integrated.defaultProfile.windows": "PowerShell 7"

说明: 指定在 Windows 上的默认集成终端配置文件为 "PowerShell 7"。这意味着当你打开新的终端时,VS Code 将默认使用 PowerShell 7。

  • terminal.integrated.persistentSessionReviveProcess
json 复制代码
"terminal.integrated.persistentSessionReviveProcess": "never"

说明: 控制终端会话的恢复行为。在这里设置为 "never",意味着当你重新打开 VS Code 时,不会恢复先前的终端会话。这通常用于确保每次打开终端时都是一个干净的状态。

  1. 重启vscode,设置默认终端

相关推荐
渐暖°1 天前
【leetcode算法从入门到精通】5. 最长回文子串
vscode·算法·leetcode
WarmSword1 天前
mac上用cursor/vscode调试root权限进程
c++·ide·vscode·macos·mac
HAPPY酷1 天前
构建即自由:一份为创造者设计的 Windows C++ 自动化构建指南
开发语言·c++·ide·windows·python·策略模式·visual studio
山峰哥1 天前
SQL优化全解析:从索引策略到查询性能飞跃
大数据·数据库·sql·编辑器·深度优先
木斯佳1 天前
OpenTiny:快速搭建实时协作文本编辑器:基于 TinyEditor 的实践指南
编辑器
取个鸣字真的难1 天前
简单快速的用 Claude Code 帮你创建 PPT 生成 Skills
vscode·powerpoint·ai编程
K·Herbert1 天前
OpenClaw 私人电脑部署风险
人工智能·安全·编辑器
henysugar1 天前
Android studio编译aidl若干问题记录
android·ide·android studio·aidl
阿斌_bingyu7091 天前
FastAdmin 混合式语言包添加繁体中文(zh-tw)完整教程
android·ide
何中应1 天前
PyCharm报`Invalid Python SDK`错误
ide·python·pycharm