COMMUNITY : BATCH LOVERS


Echo independent color

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

sort by: active | newest | oldest
Prof. Pickle says: Dec 14, 2012. 7:34 PM
@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.
Prof. Pickle in reply to Prof. PickleDec 15, 2012. 6:41 AM
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!
NachoMahma says: Feb 3, 2008. 8:59 AM
. Is this what you're talking about?
Prof. Pickle in reply to NachoMahmaDec 15, 2012. 6:40 AM
It looks like your talking about the prompt command. Unfortunately, it doesn't cover colours.
Padlock says: Aug 25, 2008. 6:17 PM
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.
westfw in reply to PadlockAug 25, 2008. 10:59 PM
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
Padlock in reply to PadlockAug 25, 2008. 6:12 PM
O... I forget to attach the file. But here it is...
XECHO.COM867 bytes
account3r2 in reply to PadlockSep 24, 2010. 4:50 PM
wait how do i make it colored?
DELETED_simkinggold (author) in reply to PadlockAug 27, 2008. 12:18 PM
(removed by author or community request)
Padlock in reply to DELETED_simkinggoldAug 27, 2008. 6:47 PM
I don't think you can make the text smaller, you might have to find a different text printing command
daWISEMAN says: Aug 22, 2008. 9:42 AM
echo -e "\033[40m\033[1;31mLight Red \033[0m replace 1;31 with 1;30 through 1;38 for different colors.
T3h_Muffinator says: Feb 3, 2008. 6:59 AM
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!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!