尝试启用powershell脚本的执行时,我一直收到此错误

时间:2015-05-11 17:58:26

标签: powershell

Set-ExecutionPolicy : Access to the registry key     'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<<  Unrestricted
+ CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAcce 
ssException
+ FullyQualifiedErrorId :    System.UnauthorizedAccessException,Microsoft.PowerShell.C 
ommands.SetExecutionPolicyCommand

有没有办法绕过这个?或者至少运行我的powershell代码?请帮忙!

1 个答案:

答案 0 :(得分:1)

您可以执行以下操作,

PowerShell.exe -ExecutionPolicy Bypass -File .runme.ps1

并在cmd提示符下运行

或将整个脚本复制并粘贴到PS控制台