Redirecting cmd stdout and sdterr back to parent

如果我使用start命令从cmd提示符创建进程(打开新的cmd),是否可以将stdout和stderr从该进程重定向回调用cmd?


If you want the output of the STARTed process to appear in the parent command console, then simply use the START /B option.

If you want to process the output of your command, then you should use FOR /F ... in ('someCommand') DO ... instead.


OK. I have yet to find a straightforward answer to this question. I didn't want to bog down my question with what I thought unnecessary detail but seeing as I'm being criticized for the lack of this I'll expand a bit here.

I want to automate the updating of FWs on our production line, so I've a python app that gets the FWs from ftp and then uses the processors flash tool via python subprocess command to upload it to the board's flash. OK for all but one of the tools.

The one tool seems to have a problem when it's not running in its own terminal, so I provide a start to the subprocess command string which allows it to run OK in its own terminal. However, I need the output from this other terminal for logging reasons.

A possible solution was to log stdout and stderr to file using >> or wintee and then poll this file via a thread in my original app (perhaps a rather convoluted solution to the question). However the tool also has a separate problem where it doesn't like any std redirection, so this doesn't work for me.

链接地址: http://www.djcxy.com/p/92306.html

上一篇: 为什么简单的重定向在Windows cmd中不起作用?

下一篇: 将cmd stdout和sdterr重定向回父