in reply to Saving a Perl session to a file

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.