2021年3月3日星期三

How can I redirect stdout/err of a program run by a batch file which is called by another batch?

If I have this batch:

ScriptA.bat

someprog.exe  

And this one:

ScriptB.bat

CALL ScriptA.bat  

And I execute a command like:

ScriptB.bat > test.log  

The output from someprog.exe is not logged. It flows through to the console. How can I avoid having to explicitly pipe the output of someprog.exe to a file, and instead just capture that from a higher level?

(Note I ultimately want to do this with a great many scripts launching assorted exes from inside those nesting, and I can't edit them all to redirect the output of each and every sub process they invoke).

https://stackoverflow.com/questions/66467134/how-can-i-redirect-stdout-err-of-a-program-run-by-a-batch-file-which-is-called-b March 04, 2021 at 09:05AM

没有评论:

发表评论