Author Options:

Echo independent color Answered

Hello i'm makin a super advanced bat file for my comp noob m8 and it looks really complcated so i was wondering is it possible to color certan lines

e.g if their was an error it be in red with the rest of the screen in green

I ALREADY know about 'color 0a' but that fills the whole screen. I need a small block or just a line to be different & stand out


@echo off &setlocal

:: Create a backspace character:
for /f "delims=#" %%a in ('"prompt #$H# &for %%b in (1) do rem"') do set "Bs=%%a"

:: Redirect a string of dot and backspaces without line break
<nul >"Hello World!.#" set /p "=.%Bs%%Bs%%Bs%%Bs%"

:: Process FINDSTR
findstr /p /a:F4 . "*.#"

:: We need a linebreak because there was no in the file.


This is not my code, it is g-one's.

Here is my edited code:

@echo off
for /f "delims=#" %%a in ('"prompt #$H# &for %%b in (1) do rem"') do set "bs=%%a"
setlocal enabledelayedexpansion
color 0a
title Colour Changer

set /p text=Type the text you want to change colours here:
set /p colour=Type the colour code here:

"%text%.@" set /p "=.%bs%%bs%%bs%%bs%"

findstr /p /a:%colour% . "*.@"
del %text%.@
pause >nul
goto start

Have fun!

. Is this what you're talking about?

It looks like your talking about the prompt command. Unfortunately, it doesn't cover colours.


Reply 9 years ago

O... I forget to attach the file. But here it is...

I don't think you can make the text smaller, you might have to find a different text printing command

Of my extensive collection of command line tools, I have this one tool...(attached) It makes large font but it can be colored differing colors. Note: I did not make this program... It was written some time ago... in german (I think?) So the help argument does no good unless you translate it.

I believe that you'll have to have loaded up the "ansi.sys" console driver (which interprets vt100-like escape sequences) or it's modern equivalent (ansi.sys is like DOS 3.1 or perhaps even earlier.) After that's working, the echo sequences with
should work (perhaps use an actual ESC char instead of \033...)

See http://en.wikipedia.org/wiki/ANSI_color

echo -e "\033[40m\033[1;31mLight Red \033[0m replace 1;31 with 1;30 through 1;38 for different colors.

Yes, there is! Unfortunately, I don't know how to do it - but a few of my friends do! I'll ask them on monday... ....err.... working on research monday, won't be on school.... tuesday is LISEF (long island science and engineering fair)..... so..... wednesday!