I occasionally need to capture a Windows cmd window session like the OP wants to do. I don't do it often enough to have worried about creating a special program to do it. I will explain how to manually do this with the normal Windows facilities. Please forgive me if I am being too basic but, I run across folks all the time who do not know how to do this. If the OP doesn't need to do this often, this may be all that is needed?

Open the command window. Go to the title bar and right click. This brings up a menu. Select Properties. Under Options, select QuickEditMode and InsertMode. Under Command History, run Buffer Size to 999. Hit "OK". When the confirmation screen shows up, Select "Save properties for future windows with same title" and hit OK. As long as you start the command window in the same way as you did this time, you won't have to do these configuration steps again.

To use this: Hold down the left mouse button to paint the text that you want. The selected area will be highlighted as a rectangle on the screen. The screen will scroll if you need more lines than are on the current screen. Let go of the left mouse button. Tap the right mouse button. This copies the highlighted cmd window rectangle to the clipboard and the highlighting disappears. Now you can use CTL-V or other method to paste the clip board into a text editor.

Note that with the command window, the normal CTL-C, CTL-V doesn't work (all key presses go to the command line). You have to use the mouse. A right click will copy the clipboard to the current command line. If you accidentally tap the right click twice in the previous paragraph, you will see that highlighted text was copied to clip board and then the 2nd click inserts it again on the command line usually with confusing and bogus results. Clip board is still ok. I mention this because everybody will inevitably make this little mistake.

Oh, the CLS command clears the screen. If I know that I am going to make a copy of the next commands/responses, I issue a CLS to clear the screen to make finding the desired text easier.

My memory may not be completely right, but my recollection of the Unix script program is that it captures the keystrokes typed, not what was displayed. So this causes problems if say you backspace to change a letter, that backspace will wind up being captured. If a password is echoed as "****", the actual password typed would be captured which is usually not what is desired. I mention this as something to think about when developing some screen capture program.


In reply to Re: Saving a Perl session to a file by Marshall
in thread Saving a Perl session to a file by gpmathis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.