Python:调用可执行文件失败



我正试图在Python中运行其中任何一个。。。

subprocess.call(r"C:WindowsSystem32fsquirt.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复制到本地目录中,我可以从那里调用它,所以我确信我一定只是在做一些关于我如何使用目录的有趣的事情。

我该怎么做?

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

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

相关内容

最新更新