1
在计算机上启动 Windows PowerShell 时,执行策略很可能是 Restricted(默认设置)。
Restricted 执行策略不允许任何脚本运行。
有关 Windows PowerShell 执行策略的详细信息,请参阅 about_Execution_Policy。
2
使用管理员身份打开powershell
了解 计算机上的现用执行策略,打开PowerShell 然后输入 get-executionpolicy
get-executionpolicy
3
开启powershell执行脚本
在powershell以管理员的身份里面执行
set-executionpolicy remotesigned
选择Y 然后电脑上就可以执行自己编写的脚本文件
参考:https://www.jianshu.com/p/4eaad2163567