【发布时间】:2017-06-12 16:12:45
【问题描述】:
我正在尝试使用多个参数调用一个 exe,它可以在命令提示符或批处理代码中工作,但在 python 中却不行。
批处理/cmd代码
"FooBar.exe" -script "some file path"
尝试了 Python 代码
from subprocess import call
args = ['FooBar.exe','-script','"some file path"']
call(args)
args = ['FooBar.exe -script "some file path"']
call(args)
args = ['FooBar.exe', '-script "some file path"']
call(args)
当我使用 python 代码时,批处理代码工作正常,但参数没有正确传递给软件(它不使用参数)。
这两种方法之间的参数传递方式是否存在根本区别?
如果我使用的是相关的:
- 来自Python.org 的 Python 3.6.1
- PyCharm Community版本:2017.1.3
- 我调用的是它的商业软件,而不是我自己的。
【问题讨论】:
标签: python python-3.x cmd arguments exe