在Python中运行这将导致WindowsError说明它找不到指定的文件
失败:
import subprocess subprocess.Popen('start notepad.exe')
在命令窗口中,它起作用
start notepad.exe
我猜它是一个path的东西,Windows无法定位开始[.exe?]这是位于哪里,所以我可以将其添加到path或只是将其包括在Popen调用。
谢谢
我不完全确定start
是一个程序。 我认为这可能是CMD shell的内置命令。 尝试
subprocess.Popen('cmd /c start notepad.exe')
另外,为什么不使用的任何理由:
subprocess.Popen('notepad.exe')