win10 powershell禁止運行腳本解決


win10 現在默認策略為 Restricted

該策略情況下是禁止在終端下運行腳本文件的,所以我們想要通過powershell 來運行我們的腳本文件的話就需要我們更改其策略才行,如下命令可以幫助你(記得以管理員身份打開 powershell)

# 查看當前執行策略
get-executionpolicy

# 更改執行策略為 RemoteSigned
Set-ExecutionPolicy RemoteSigned

然后再試試?不行的話重新打開 powershell 就好了

 

關於執行策略可以詳看官方的文檔 https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-6


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM