How can I change the text color in the windows command prompt

后端 未结 14 2666
南旧
南旧 2020-12-14 22:32

I have a command line program, which outputs logging to the screen.

I want error lines to show up in red. Is there some special character codes I can output to switc

14条回答
  •  盖世英雄少女心
    2020-12-14 23:08

    color [background][foreground]

    Where colors are defined as follows:

    0 = Black    8 = Gray
    1 = Blue     9 = Light Blue
    2 = Green    A = Light Green
    3 = Aqua     B = Light Aqua
    4 = Red      C = Light Red
    5 = Purple   D = Light Purple
    6 = Yellow   E = Light Yellow
    7 = White    F = Bright White
    

    For example, to change the background to blue and the foreground to gray, you would type:

    color 18

提交回复
热议问题