问题随记 ——【Windows】无法加载文件 C:\Users\Administrator\Documents\WindowsPowerShell\profile.ps1

问题描述

打开 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进行确认

在这里插入图片描述

注意:一定要以管理员权限运行,否则会出现以下报错。

在这里插入图片描述

posted @ 2022-06-12 22:20  繁依Fanyi  阅读(57)  评论(0)    收藏  举报  来源