从资源管理器运行 powershell 脚本 = 执行策略错误

Ian*_*ing 4 powershell

  1. 在 Windows 7 final 我已经完成了:Set-ExecutionPolicy unrestricted
  2. 在windows资源管理器中,我选择一个script.ps1文件,选择打开方式,放入c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
  3. Powershell 窗口会短暂闪烁,并显示有关执行策略的错误。

脚本在 powershell 中运行良好。如何从 Windows 资源管理器中运行它们?

Joe*_*oey 5

您确定这是执行策略错误吗?如果是 PowerShell v2,请尝试-File在文件名前包含参数:

"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -File "%1"
Run Code Online (Sandbox Code Playgroud)