powershell对于脚本的执行有着严格的安全限制
Get-ExecutionPolicy -List
Set-ExecutionPolicy -Scope CurrentUser AllSigned
Policies:
Restricted / AllSigned / RemoteSigned / Unrestricted / Bypass / Undefined
Scopes:
Process / CurrentUser / LocalMachine
process仅对当前进程有效,可以用作临时使用,例如:
Set-ExecutionPolicy Bypass -Scope Process -Force; npm-windows-upgrade
参考:
获取执行策略限制
设置执行策略限制
执行策略文档
https://chocolatey.org/install
原文:https://www.cnblogs.com/wswind/p/10911286.html