You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中PowerShell扩展失效问题的排查与修复咨询

解决VS Code中PowerShell扩展失效问题

问题根源

从exthost.log日志可定位核心错误:

Error: command 'PowerShell.ShowLogs' already exists

原因是同时安装了正式版PowerShell扩展(ms-vscode.powershell)和预览版PowerShell扩展(ms-vscode.powershell-preview),两者注册了重复命令,导致扩展激活失败,进而引发Intellisense无响应、F8运行功能失效、状态栏PowerShell持续加载,以及右键菜单选项重复的问题。

解决步骤

  • 卸载冲突扩展:打开VS Code扩展面板,找到PowerShell和PowerShell Preview,全部卸载后重启VS Code。
  • 清理残留数据:手动删除扩展残留文件夹,路径为C:\Users\Administrator\.vscode\extensions,删除所有以ms-vscode.powershell和ms-vscode.powershell-preview开头的文件夹。
  • 重装单一版本扩展:仅安装正式版PowerShell扩展(或按需选择预览版,禁止同时装两个版本),安装完成后重启VS Code。
  • 验证功能:打开PowerShell脚本文件,检查状态栏PowerShell是否正常加载,测试Intellisense提示、F8运行选中代码功能,确认右键菜单无重复选项。

额外排查建议

  • 检查Windows Server 2022上的PowerShell版本,确保为PowerShell 5.1或更高版本,低版本可能存在兼容性问题。
  • 若问题仍存在,可尝试重置VS Code设置:按下Ctrl+Shift+P,输入Preferences: Reset Settings,重置前注意备份自定义设置。

内容的提问来源于stack exchange,提问作者JohnB

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 16:01:28