Sep 19, 2015 08:42 AM
(This post was last modified: Sep 19, 2015 08:45 AM by Alumni Theorist.)
Hello! I made this thread as many people seem to not know how to use multiple colors on the same line of text or several lines of text in batch. I did not originally make this script I just tweaked it a bunch.
This would go at the beginning of your script after "@echo off" (if used):
Now, this piece of code would go at the very end of your code, after all the functions you wish to implement color into:
Now, to utilize this, we will use the 'call' function.
Example:
This would display text1 text2
on the same line. In order to separate the lines so it displays as
"text1."
"text2."
It would look like this:
That is all! You now have multicolored text <3
This would go at the beginning of your script after "@echo off" (if used):
PHP Code
<?php
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
Now, this piece of code would go at the very end of your code, after all the functions you wish to implement color into:
PHP Code
<?php
:colorEcho
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1i
Now, to utilize this, we will use the 'call' function.
Example:
PHP Code
<?php
call :colorEcho 0a "text1"
call colorEcho 0b " text2"
on the same line. In order to separate the lines so it displays as
"text1."
"text2."
It would look like this:
PHP Code
<?php
call :colorEcho 0a "text1" & echo.
call :colorEcho 0b "text2" & echo.
That is all! You now have multicolored text <3



![[Image: 0UhKI.gif]](https://i.imgur.com/0UhKI.gif)
