in reply to Capturing the text in a Console Window

Assuming you have two Command windows running. One, currently idle (hence the regex '^command Prompt$'), that you wish to capture whatever is in it's buffer, and the other in which you will invoke this script (which will fail to match the regex because it will have the title text 'Command Prompt -' or similar).

This will capture the contents of the idle sessions buffer and print on the console where you run this script. If you have multiple idle windows, then it will capture and dump them all. Adjust the regex to select the appropriate window.

#! perl -slw use strict; use Win32::GuiTest qw[ FindWindowLike SendKeys SetForegroundWindow ]; use Win32::Clipboard; my $clip = Win32::Clipboard(); for my $w ( FindWindowLike( 0, '^Command Prompt$', 0, 0, 0 ) ) { SetForegroundWindow( $w ); SendKeys( '%{SPC}ES%{SPC}Ey' ); print $clip->Get(); }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.