我的 powershell 在启动时崩溃

我的 powershell 在启动时崩溃

我的 powershell 出了问题。

启动时丢弃以下日志

Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Management.Automation.TypeAccelerators' threw an exception. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at System.Management.Automation.CoreTypes.<>c.<.cctor>b__2_0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Management.Automation.TypeAccelerators..cctor()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.EarlyStartup.<>c.<Init>b__0_1()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

有什么帮助吗?我使用的是 Windows 10

答案1

检查您的 powershell 配置文件脚本,并清除任何有问题的命令或问题。启动 powershell 时会运行该脚本。

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7#long-description

相关内容