简体   繁体   English

启动 exetrnal cmd.exe 文件并使用子进程 python 将参数传递给它

[英]Launching exetrnal cmd.exe file and passing parameters to it using subprocess python

i am trying to launch external cmd.exe file(atmelstudio.exe file) and pass arguments to it.我正在尝试启动外部 cmd.exe 文件(atmelstudio.exe 文件)并将参数传递给它。 but when i run the script using subprocees.call(,args), i can only see atmelstudio.exe popping out without any passed parameters.但是当我使用 subprocees.call(,args) 运行脚本时,我只能看到 atmelstudio.exe 在没有任何传递参数的情况下弹出。

subprocess.call([atmel_cmd, 'atprogram'])

this is the command window pop up after exceuting the above line:这是执行上述行后弹出的命令窗口:

please suggest how to pass arguments to this application using python.请建议如何使用 python 将参数传递给这个应用程序。

From what I see atprogram needs additional arguments.从我看到的 atprogram 需要额外的参数。

Usage: atprogram [options] <command> [arguments] [<command> [arguments] ...]

I would tried atprogram help to see whether the arguments are passed or not.我会尝试 atprogram help 来查看参数是否被传递。

subprocess.call([atmel_cmd, 'atprogram' , 'help'])

I assume that atmel_cmd is also a string.我假设 atmel_cmd 也是一个字符串。 Rather than that the call itself looks alright.而不是调用本身看起来没问题。

Here atprogramm documentation for further reference.这里atprogramm 文档以供进一步参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM