问题描述
打开 PowerShell 出现以下报错:
. : 无法加载文件 C:\Users\Administrator\Documents\WindowsPowerShell\profile.ps1。未对文件 C:\Users\Administrator\Docume
nts\WindowsPowerShell\profile.ps1 进行数字签名。无法在当前系统上运行该脚本。有关运行脚本和设置执行策略的详细信息,请参
阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 3
+ . 'C:\Users\Administrator\Documents\WindowsPowerShell\profile.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解决方法
① 管理员权限运行 PowerShell,并输入以下命令
set-executionpolicy remotesigned
② 再输入Y
进行确认
注意:一定要以管理员权限运行,否则会出现以下报错。