YMaster

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

分类:

技术点:

相关文章:

  • 2021-09-18
  • 2021-11-20
  • 2021-06-06
  • 2021-04-01
  • 2021-10-01
  • 2021-12-25
  • 2021-05-12
  • 2021-12-04
猜你喜欢
  • 2021-04-11
  • 2021-11-30
  • 2021-11-11
  • 2021-06-13
  • 2021-08-27
  • 2021-07-21
  • 2019-11-27
相关资源
相似解决方案