Reputation: 11046
If I have this batch:
someprog.exe
And this one:
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).
Upvotes: 0
Views: 1223
Reputation: 11046
I found the answer to this on another SO thread:
https://stackoverflow.com/a/11955380/3220983
As you'll see if reading the comments under the question, the problem I was encountering was that the messages I couldn't capture were not being piped to stdout or stderr at all! They were going straight to the console via something akin to a CON
redirect from inside the specific executable I was trying to use.
The link I posted shows how to launch a PowerShell script from a batch script, which captures the entire console window contents, inclusive of CON
output!
Upvotes: 1