簡單說明
powershell對於腳本的執行有着嚴格的安全限制
Get-ExecutionPolicy -List #查看當前的執行策略
Set-ExecutionPolicy -Scope CurrentUser AllSigned #設置執行策略為要求所有腳本簽名,范圍為當前用戶
策略 Policies:
Restricted / AllSigned / RemoteSigned / Unrestricted / Bypass / Undefined
范圍 Scopes:
Process / CurrentUser / LocalMachine
設置策略
臨時使用,不想修改執行策略為較低的權限,可使用:
Set-ExecutionPolicy Bypass -Scope Process -Force; npm-windows-upgrade
開發人員需頻繁使用powershell腳本,運行本地腳本運行,可使用:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
