How do I color output text from Perl script on Windows?

后端 未结 5 953
别那么骄傲
别那么骄傲 2021-02-06 00:36

I would like to color format the text printed to the console using the Perl print command.

In my case the script will only be run under WinXP-DOS Command Line but it wou

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 01:09

    system("color A"); #DOS command, change text color to lime
    
    system("color 7"); #DOS command, change text color to white
    

    However those commands change text color on the whole screen. Type "color ?" in DOS window to see color options

    I am using strawberry perl on Windows and I did not have Win32::Console package. To install this package type in console:

    perl -MCPAN -e shell

    install Win32::Console

    exit

提交回复
热议问题