[英]Why does python subprocess.Popen launch a subprocess through cmd.exe?
I call subprocess like this: 我这样称呼子进程:
command = 'c:\somepath\myexe.exe'
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
p = subprocess.Popen(command, shell=False, startupinfo=startupinfo)
It appears that instead of launching myexe.exe directly, it goes through cmd.exe. 似乎不是直接启动myexe.exe,而是通过cmd.exe。 Can I avoid cmd.exe here?
我可以在这里避免使用cmd.exe吗?
Iff you're using Python 2.7 - use subprocess._subprocess.STARTF_USESHOWWINDOW instead of subprocess.STARTF_USESHOWWINDOW. 如果您使用的是Python 2.7,请使用subprocess._subprocess.STARTF_USESHOWWINDOW而不是subprocess.STARTF_USESHOWWINDOW。 I think this would solve it.
我认为这可以解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.