如何使用Python中的参数运行外部程序

如何使用Python中的参数运行外部程序,python,cmd,Python,Cmd,通常在PowerShell I中运行命令: cd C:\Users\aaa\Desktop\File Namee\ 然后我用特定参数执行程序: .\program.exe /F:aa.dvl /PPP_ZZZ 现在我的问题是,如何用python脚本执行它?我尝试了子流程和os.system,但它对我不起作用 file=['C:\\Users\\aaa\\Desktop\\file Namee\\','.program.exe/F:aa.dvl/pppzzz'] subprocess.call

通常在PowerShell I中运行命令:

cd C:\Users\aaa\Desktop\File Namee\
然后我用特定参数执行程序:

.\program.exe /F:aa.dvl /PPP_ZZZ
现在我的问题是,如何用python脚本执行它?我尝试了子流程和os.system,但它对我不起作用

file=['C:\\Users\\aaa\\Desktop\\file Namee\\','.program.exe/F:aa.dvl/pppzzz']
subprocess.call(文件)
试试下面的方法

file = ['C:\\Users\\aaa\\Desktop\\File Namee\\program.exe', '/F:aa.dvl' '/PPP_ZZZ']
subprocess.call(file)

所以每个参数都是一个单独的列表元素。

试试这个
os.system(“/path/to/exe/File.exe-parameters-params”)

检查这个。这对我来说是有效的:
os.system(“C:\\Users\\aaa\\Desktop\\File name\\program.exe/F:C:\\Users\\aaa\\Desktop\\File name\\aa.dvl/PPP\ZZZ”)