
如何突出顯示cmd中的數字?即,我想在鍵入舊命令時自動突出顯示數字。
我怎樣才能實現這個目標?
我想將 cmd 中的數字與其他命令區分開來,使其可讀。
答案1
據我所知,CMD僅支援指定的固定前景色和背景色,您可以使用COLOR命令更改
Sets the default console foreground and background colors.
COLOR [attr]
attr Specifies color attribute of console output
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:
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
If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.
Example: "COLOR fc" produces light red on bright white
您不能為不同的字元指定不同的顏色。