Update: Caution: This is only tested under Windows 7!

Play around with Win32::Console. This script
Script: cap_con_1.pl

use warnings; use strict; use Win32::Console 'STD_OUTPUT_HANDLE'; use Data::Dump qw(dd); my $con_current = Win32::Console->new(STD_OUTPUT_HANDLE); $con_current or die 'new Win32::Console failed'; my ($left, $top, $right, $bottom) = $con_current->Window; print qq($left, $top, $right, $bottom \n); my $rect = $con_current->ReadRect($left, $top, $right, $bottom); $rect or die 'read Win32::Console failed'; $rect =~ s{ \0\a\0 } ''xmsg; $rect =~ s{ [ ]+ \z } ''xmsg; dd $rect; print qq{======\n$rect\n======\n};
Captures:
c:\@Work\Perl\monks\gpmathis>perl -wMstrict -le "print qq{\nHow old are you?: }; my $age = <STDIN>; my $year = 2017 - $age; print qq{You were born in $year\n}; " How old are you?: 42 You were born in 1975 c:\@Work\Perl\monks\gpmathis>perl cap_con_1.pl 0, 0, 99, 59 " c:\\\@Work\\Perl\\monks\\gpmathis>perl -wMstrict -le \"print qq{\\nHow old are you?: }; my \$age = <STDIN>; my \$year = 2017 - \$age; print qq{You were born in \$year\\n}; \" How old are you?: 42 You were born in 1975 c:\\\@Work\\Perl\\monks\\gpmathis>perl cap_con_1.pl 0, 0, 99, 59" ====== c:\@Work\Perl\monks\gpmathis>perl -wMstrict -le "print qq{\nHow old are you?: }; my $age = <STDIN>; my $year = 2017 - $age; print qq{You were born in $year\n}; " How old are you?: 42 You were born in 1975 c:\@Work\Perl\monks\gpmathis>perl cap_con_1.pl 0, 0, 99, 59 ====== c:\@Work\Perl\monks\gpmathis>

Update: Use cls to begin a "session". You should be able to futz around with the captured  $rect string to clip off the invocation of the script at the end. Also, the Perl script can be converted into a  .bat file with the venerable Windows Batch Wrapper trick:
File: capsess.bat

@REM = 'windows batch wrapper @ECHO off perl %0.bat goto BYEBYE ' if 0; use warnings; use strict; use Win32::Console 'STD_OUTPUT_HANDLE'; my $con_current = Win32::Console->new(STD_OUTPUT_HANDLE); $con_current or die 'new Win32::Console failed'; my ($left, $top, $right, $bottom) = $con_current->Window; my $width = $right - $left + 1; my $rect = $con_current->ReadRect($left, $top, $right, $bottom); $rect or die 'read Win32::Console failed'; $rect =~ s{ \0\a\0 } ''xmsg; $rect =~ s{ [ ]+ \z } ''xms; $rect =~ s{ .{$width} \z } ''xms; print qq{======\n$rect\n======\n}; __END__ :BYEBYE
Session:
c:\@Work\Perl\monks\gpmathis>--- c:\@Work\Perl\monks\gpmathis>perl -wMstrict -le "print qq{\nHow old are you?: }; my $age = <STDIN>; my $year = 2017 - $age; print qq{You were born in $year\n}; " How old are you?: 42 You were born in 1975 c:\@Work\Perl\monks\gpmathis>capsess ====== c:\@Work\Perl\monks\gpmathis>--- c:\@Work\Perl\monks\gpmathis>perl -wMstrict -le "print qq{\nHow old are you?: }; my $age = <STDIN>; my $year = 2017 - $age; print qq{You were born in $year\n}; " How old are you?: 42 You were born in 1975 ====== c:\@Work\Perl\monks\gpmathis>
Caution: This is only tested under Windows 7!


Give a man a fish:  <%-{-{-{-<


In reply to Re: Saving a Perl session to a file by AnomalousMonk
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.