Make your own programs to do what you want.
Unlike the 13 stupid answers on the linked duplicate page. This will be blindly fast. CMD.exe opens a batchfile, reads 1 line, closes the file. It repeats for each line. Worse using variables means the environment block needs to be resorted each time.
@ColourText f2 F2 *********************************
@ColourText F4 F2 Warning
@Echo ***************************************
REM ColourText.bat
REM Compiles ColourText.vb to ColourText.exe
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:exe /out:"%~dp0\ColourText.exe" "%~dp0\ColourText.vb" /verbose
pause
'ColourText.vb
Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Module MyApplication
Public Declare Function GetStdHandle Lib "kernel32" Alias "GetStdHandle" (ByVal nStdHandle As Long) As Long
Public Declare Function SetConsoleTextAttribute Lib "kernel32" Alias "SetConsoleTextAttribute" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
Public Const STD_ERROR_HANDLE = -12&
Public Const STD_INPUT_HANDLE = -10&
Public Const STD_OUTPUT_HANDLE = -11&
Sub Main()
Dim hOut as Long
Dim Ret as Long
Dim Colour As Long
Dim Colour1 As Long
Dim Text As String
hOut = GetStdHandle(STD_OUTPUT_HANDLE)
Colour = CLng("&h" & Split(Command(), " ")(0))
Colour1 = Clng("&h" & Split(Command(), " ")(1))
Text = Mid(Command(), 7)
Ret = SetConsoleTextAttribute(hOut, Colour)
Console.Out.WriteLine(text)
Ret = SetConsoleTextAttribute(hOut, Colour1)
End Sub
End Module
To use
ColourText <ColourOfText> <ColourOfTextWhenFinished> [Text]
Also the CLS command becomes interesting. Color command without parameters resets all colours to startup colours.
To get the colour code add the following numbers together. Use Calculator in programmers mode. These are hex numbers. They can be added together eg Red + Blue + FG Intensity = 13 = D. As 10+ wasn't used the background will be black. Colour codes MUST be two characters, eg 08 not 8.
FOREGROUND_RED = &H4 ' text color contains red.
FOREGROUND_INTENSITY = &H8 ' text color is intensified.
FOREGROUND_GREEN = &H2 ' text color contains green.
FOREGROUND_BLUE = &H1 ' text color contains blue.
BACKGROUND_BLUE = &H10 ' background color contains blue.
BACKGROUND_GREEN = &H20 ' background color contains green.
BACKGROUND_INTENSITY = &H80 ' background color is intensified.
BACKGROUND_RED = &H40 ' background color contains red.
So black backgroung is 0 while white is F0 (adding 10 + 20 + 40 + 80). Red on white is f4.
EDIT
This prints <GREEN>*<RED>Warning<GREEN>*
Use the right tool for the job.
'ColourText1.vb
Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Module MyApplication
Public Declare Function GetStdHandle Lib "kernel32" Alias "GetStdHandle" (ByVal nStdHandle As Long) As Long
Public Declare Function SetConsoleTextAttribute Lib "kernel32" Alias "SetConsoleTextAttribute" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
Public Const STD_ERROR_HANDLE = -12&
Public Const STD_INPUT_HANDLE = -10&
Public Const STD_OUTPUT_HANDLE = -11&
Sub Main()
Dim hOut as IntPtr
Dim Ret as Integer
hOut = GetStdHandle(STD_OUTPUT_HANDLE)
Ret = SetConsoleTextAttribute(hOut, &hfA)
Console.Out.Write("*")
Ret = SetConsoleTextAttribute(hOut, &hfC)
Console.Out.Write("Warning")
Ret = SetConsoleTextAttribute(hOut, &hfA)
Console.Out.Write("*" & vbcrlf)
End Sub
End Module