Python:调用可执行文件失败

2024-10-03 11:13:09 发布

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

我正在用Python运行任何一个。。。你知道吗

subprocess.call(r"C:\Windows\System32\fsquirt.exe", shell=True)
subprocess.call("C:\\Windows\\System32\\fsquirt.exe", shell=True)
subprocess.call(r"C:/Windows/System32/fsquirt.exe", shell=True)
subprocess.call("C:/Windows/System32/fsquirt.exe", shell=True)

它们都会导致。。。你知道吗

'C:/Windows/System32/fsquirt.exe' is not recognized as an internal or external command,
operable program or batch file.

如果我抄下来fsquirt.exe文件我可以从那里调用本地目录,所以我肯定我只是在做一些不知道如何使用目录的事情。你知道吗

我该怎么做?你知道吗


Tags: or目录antrueiswindowsasnot
1条回答
网友
1楼 · 发布于 2024-10-03 11:13:09

问题是我使用的是64位Windows,它不使用System32(从32位Python运行)。64位Windows通常使用SysWOW64而不是System32。调用虚拟目录Sysnative而不是其中任何一个将根据您正在运行的内容(对我来说,是32位Python)来确定需要调用哪一个。Fsquirt只存在于System32中,而不存在于SysWOW64中。这与存在于两者中的记事本不同。你知道吗

subprocess.call("C:/Windows/Sysnative/fsquirt.exe")

相关问题 更多 >