在此系统上禁止运行脚本,解决方法
在 VScode 或者 PowerShell 中 运行hexo或者其他命令出现以下问题:
无法加载文件 C:\Users\DH\Desktop\cs\rename.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参
阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
- CategoryInfo : SecurityError: (:) [],ParentContainsErrorRecordException
- FullyQualifiedErrorId : UnauthorizedAccess
Restricted 执行策略不允许任何脚本运行。
AllSigned 和 RemoteSigned 执行策略可防止 Windows PowerShell 运行没有数字签名的脚本。
本主题说明如何运行所选未签名脚本(即使在执行策略为 RemoteSigned 的情况下),还说明如何对 脚本 行签名以便您自己使用。
有关 Windows PowerShell 执行策略的详细信息,请参阅 about_Execution_Policy。
解决办法
以管理员身份打开 VScode终端 或者 PowerShell 输入
1 >set-executionpolicy remotesigned
评论