我正在尝试从Python运行powershell脚本。 我这里有一个代码:
import subprocess
subprocess.Popen(["powershell.exe","C:\\Users\\Someone\\Documents\\Scripts\\Script.ps1"])
但当我这么做的时候,我会
cannot be loaded because running scripts
is disabled on this system. For more information, see about_Execution_Policies at ...
我在网上做了一些调查,发现我需要找到
ExecutionPolicy
在
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
我需要将它修改为
Unrestricted
所以现在,我的目标是让我的Python代码自动检查这一点,并将其设置为无限制,或者创建一个具有无限制值的新ExecutionPolicy(我的计算机就是这样)
我真的不知道在哪里或如何尝试这一点
目前没有回答
相关问题 更多 >
编程相关推荐