【发布时间】:2015-11-28 07:06:20
【问题描述】:
我想运行位于与当前目录不同的 MyFolder 中的 mybat.bat 文件。我使用了以下代码:
subprocess.Popen(["mybat", MyArg],
cwd=MyFolder,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
但是,我收到以下错误:
"WindowsError: [Error 2] The system cannot find the file specified"
我应该提到,如果我用 PATH 中的另一个程序(例如 notepad)替换 mybat,它绝对可以正常工作。
【问题讨论】:
-
是的。我的文件夹中有 mybat.bat 文件。
标签: python windows batch-file subprocess