Capture Command Window output without redirection

sqjoatmon

New member
Joined
Jan 30, 2013
Messages
2
Programming Experience
5-10
Hi,

I have a third-party (closed source) executable that I run with Task Scheduler via a batch script. I'd like to capture all the output of this executable for logging purposes. Inexplicably, if I use regular old stdout or stderr redirection in the batch file, some of the text that is displayed in the command window is captured in the log file and some is not.

So my question is the following: Is it possible to use the Windows API to directly read the text contents of a Command Prompt window? I figure if I can poll that window I might be able to capture the text. I messed around with AutoIt once and this seemed like the kind of thing it could do, but I'd prefer to work with VB.NET for this purpose.

Thanks.
 
Enter the following search in Google: "Automate Command Prompt Window (CMD), Redirect Output to Application"
That will answer your question.
I hesitate to publish the link for you because I am unsure of Admins' policy on posting cross references to other sites.
Some forums do not permit this.

Best regards,
Rob
 
Enter the following search in Google: "Automate Command Prompt Window (CMD), Redirect Output to Application"
That will answer your question.

Thank you, Rob. I tried that, and it did not work. (Creating a process and using the standard input/standard output methods.)

I'm looking for something a bit more "hackish", where the literal GUI window is actually "read". I might be pushing my luck here.

-Randy
 
Back
Top