I run ffmpeg from a windows console. It colors its messages, eg. warnings are (red) yellow and errors are bright red. That's all good, but when I interrupt ffmpeg, it sometimes leaves the console color changed and then all further text in the same console will be written in that color.

The cls command does not restore the color like it used to in some windows versions. Rerunning ffmpeg doesn't help because it checks the console color when it starts and restores that when it exits. I don't wish to close the console and start a new one because that would lose the command history. Thus, I need a separate command to reset the console colors. Here's a simple command to do that (put it into a batch file). Works with ActiveState perl 5.16.1.

perl -we "use Win32::Console; $con = Win32::Console->new(STD_OUTPUT_HA +NDLE()); $con->Attr($ATTR_NORMAL);"

In reply to Restore normal text color in windows console by ambrus

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.