PowerShell UnauthorizedAccess
使用
PowerShell
执行命令时报错UnauthorizedAccess
问题
执行 Set-ExecutionPolicy remotesigned
命令即可
Set-ExecutionPolicy remotesigned
演示:
PS C:\Users\hasee> plop
plop : 无法加载文件 F:\storage\nodejs\node_global\plop.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.
microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ plop
+ ~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\hasee> get-ExecutionPolicy
Restricted
PS C:\Users\hasee> Set-ExecutionPolicy remotesigned
PS C:\Users\hasee> get-ExecutionPolicy
RemoteSigned
PS C:\Users\hasee> plop
[PLOP] No plopfile found
Usage:
$ plop Select from a list of available generators
$ plop <name> Run a generator registered under that name
$ plop <name> [input] Run the generator with input data to bypass prompts