WindowsError:[错误740]请求的操作即使在禁用UAC之后也需要提升

2024-04-27 22:51:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我禁用了UAC并用python运行我的脚本。

command = "abcd.exe"
subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

另外,我将应用程序abcd.exe从其属性设置为以管理员身份运行。

然后我得到以下错误:

WindowsError: [Error 740] The requested operation requires elevation


Tags: 脚本应用程序属性管理员stderrstdout身份exe
2条回答

您可以尝试使用:

subprocess.call(["abcd.exe"], shell=True)

基本上这里的重要部分是shell=True;如果设置为False,则会得到以下错误。

WindowsError: [Error 740]

我认为问题在于使用subprocess.Popen。

我也认为你的问题已经在这里得到了回答: Request UAC elevation from within a Python script?

相关问题 更多 >