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

PowerShell错误代码65536求助:无法打开PowerShell及VS2022终端

解决终端进程退出代码65536及PowerShell无法打开问题

1. 检查并调整PowerShell执行策略

打开命令提示符(CMD),先执行以下命令查看当前执行策略:

powershell -Command "Get-ExecutionPolicy"

若返回结果不是RemoteSigned或Unrestricted,执行命令修改策略(按提示输入Y确认):

powershell -Command "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"

2. 重置PowerShell核心配置

在CMD中运行以下命令,重置PowerShell模块路径、备份并清空用户配置文件,随后尝试重启PowerShell:

powershell -Command "$env:PSModulePath = $env:PSModulePath -split ';' | Where-Object { $_ -ne '' }; $env:PSModulePath = $env:PSModulePath -join ';'; Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' -Name 'Local AppData' -Value $env:LOCALAPPDATA; $profilePath = $PROFILE; if (Test-Path $profilePath) { Rename-Item $profilePath $profilePath'.old' }; Start-Process powershell"

3. 重置Visual Studio终端配置

打开Visual Studio 2022,按路径操作:工具 > 选项 > 终端

  • 确认默认终端设置为Windows PowerShell或Command Prompt
  • 点击「重置所有终端实例」按钮
  • 重启Visual Studio后再次尝试打开终端

4. 检查并修复系统环境变量

右键「此电脑」→ 属性 → 高级系统设置 → 环境变量

  • 检查Path变量中是否包含C:\Windows\System32\WindowsPowerShell\v1.0\,缺失则手动添加
  • 检查PSModulePath变量,确保包含默认路径:C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules

5. 重装PowerShell组件

打开设置 → 应用 → 可选功能

  • 找到「Windows PowerShell」点击卸载
  • 重启电脑后,回到可选功能页面,点击「添加功能」,搜索并重新安装Windows PowerShell

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 03:45:53