2042Views11Replies

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

11 Replies

user
Prof. Pickle (author)2012-12-14

@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.
echo(

pause



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

Select as Best AnswerUndo Best Answer

user

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

:start
cls
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!

Select as Best AnswerUndo Best Answer

user
NachoMahma (author)2008-02-03

. Is this what you're talking about?

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)NachoMahma2012-12-15

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

Select as Best AnswerUndo Best Answer

user
Padlock (author)2008-08-25

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

Select as Best AnswerUndo Best Answer

user
account3r2 (author)Padlock2010-09-24

wait how do i make it colored?

Select as Best AnswerUndo Best Answer

user
Padlock (author)2008-08-27

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

Select as Best AnswerUndo Best Answer

user
Padlock (author)2008-08-25

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.

Select as Best AnswerUndo Best Answer

user
westfw (author)Padlock2008-08-25
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
\033[1;38m
should work (perhaps use an actual ESC char instead of \033...)

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

Select as Best AnswerUndo Best Answer

user
daWISEMAN (author)2008-08-22

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

Select as Best AnswerUndo Best Answer

user
T3h_Muffinator (author)2008-02-03

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!

Select as Best AnswerUndo Best Answer