我遇到了一个非常奇怪的问题,powershell 似乎在启动时挂起,但仅限于版本 3:
C:\WINDOWS\system32>powershell -version 2.0
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\WINDOWS\system32> exit
C:\WINDOWS\system32>powershell -version 3.0
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
_ (blinking cursor here)
如果我按下 ctrl-break,powershell 就会崩溃。Windows 错误报告显示 Microsoft.PowerShell.ConsoleHost.BreakIntoDebugger 中存在异常,因此这可能与此有关。我找不到有关在 Windows 10 上重新安装 powershell 的任何信息,所以我不确定如何继续。从程序和功能中添加和删除 powershell 2 没有帮助,重新启动也没有帮助。我也尝试过,powershell -noprofile
结果相同。我也试过了powershell -Command {echo "test"}
,它永远挂起,我无法按 ctrl-break。
答案:
Version=1
EventType=PowerShell
EventTime=131305552298905352
ReportType=1
Consent=1
UploadTime=131305552299996306
ReportIdentifier=7f7872e4-e9a7-11e6-8287-6245b4ec6498
AppSessionGuid=00002eac-0001-000f-73e4-9681b37dd201
TargetAppId=W:0000f519feec486de87ed73cb92d3cac802400000000!0000044a0cf1f6bc478a7172bf207eef1e201a18ba02!powershell.exe
TargetAppVer=2016//09//15:16:31:49!789c3!powershell.exe
BootId=4294967295
Response.BucketId=c8f5b6fc0a27bdd03326cfefd2006eb7
Response.BucketTable=5
Response.LegacyBucketId=127762705495
Response.type=4
Sig[0].Name=NameOfExe
Sig[0].Value=powershell.exe
Sig[1].Name=FileVersionOfSystemManagementAutomation
Sig[1].Value=10.0.14393.693
Sig[2].Name=InnermostExceptionType
Sig[2].Value=System.NullReferenceException
Sig[3].Name=OutermostExceptionType
Sig[3].Value=System.NullReferenceException
Sig[4].Name=DeepestPowerShellFrame
Sig[4].Value=Microsoft.PowerShell.ConsoleHost.BreakIntoDebugger
Sig[5].Name=DeepestFrame
Sig[5].Value=Microsoft.PowerShell.ConsoleHost.BreakIntoDebugger
Sig[6].Name=ThreadName
Sig[6].Value=unknown
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=10.0.14393.2.0.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=3081
UI[3]=powershell has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
State[0].Key=Transport.DoneStage1
State[0].Value=1
FriendlyEventName=PowerShell
ConsentKey=PowerShell
AppName=powershell
AppPath=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
ApplicationIdentity=00000000000000000000000000000000
MetadataHash=-149969992
DISM 修复的输出:
C:\WINDOWS\system32>DISM /Online /Cleanup-Image /CheckHealth
Deployment Image Servicing and Management tool
Version: 10.0.14393.0
Image Version: 10.0.14393.0
No component store corruption detected.
The operation completed successfully.
答案1
这似乎是我的防病毒扫描程序 (AVG) 的问题。禁用它可以解决问题,并且一旦我重新启用防病毒程序,powershell 就会继续工作。