changing the color of a single line in a cmd window

M

Mombiatch

Hi

I'm trying to change a single line of output from a batch file to red (to
show there's an error). I tried 'color c' but this changed the entire
window's text :p Anyone have any ideas? I used to work for Microsoft and
saw this plenty of times, but then again, it might have been
Console.Writeline in an exe rather than a batch file.

Thanks
Joe
 
H

Herbert Kleebauer

Mombiatch said:
I'm trying to change a single line of output from a batch file to red (to
show there's an error). I tried 'color c' but this changed the entire
window's text :p Anyone have any ideas? I used to work for Microsoft and
saw this plenty of times, but then again, it might have been
Console.Writeline in an exe rather than a batch file.

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>ctext.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>ctext.com
echo pZsAZ~ZzOL@KtZ{O@}1guN?_g~K=G?U_Pg]NYG?w?KgBw}IqtH@wR?wABO>>ctext.com
echo LrFZp{@XEKH@lQNgw@ECuQtj{OM?DG@@_Aqo{Ox{R?kNv@ZjosB@IoXEFr>>ctext.com
echo @W@K~Xj~@XeK??BB0x>>ctext.com

cls
echo 1. echo line

ctext 10 20 9 This is a light blue/black text at pos 10,20
ctext 11 20 2 This is a green/black text at pos 11,20
ctext 12 20 4 This is a red/black text at pos 12,20
ctext 13 20 12 This is a light red/black text at pos 13,20

echo 2. echo line

ctext +15 20 160 This is a black/light green text at pos 15,20

echo 3. echo line

del ctext.com

:: usage: ctext line column color text
:: write text with color "color" to screen at pos (line,column)
:: use a + before column to update cursor position
 
M

Matthias Tacke

Mombiatch said:
Hi

I'm trying to change a single line of output from a batch file to red (to
show there's an error). I tried 'color c' but this changed the entire
window's text :p Anyone have any ideas? I used to work for Microsoft and
saw this plenty of times, but then again, it might have been
Console.Writeline in an exe rather than a batch file.

Thanks
Joe
Wbat from Horst Schaeffer
http://home.mnet-online.de/horst.muc/

or the conutils from Frank P.Westlake
Tools hosted by Ted Davis at http://gearbox.maem.umr.edu/fwu/

Colorx in the Batch Script Tools from Bill Stewart can do this
http://mywebpages.comcast.net/stewartb/bst.html

The last one IMO easiest to use:

@echo off
colorx -l
colorx -c C0
echo this line in black on red background
colorx -c 1e
echo this is my favorite yellow on blue

HTH
 
M

Matthias Tacke

Herbert said:
Mombiatch said:
I'm trying to change a single line of output from a batch file to red (to
show there's an error). I tried 'color c' but this changed the entire
window's text :p Anyone have any ideas? I used to work for Microsoft and
saw this plenty of times, but then again, it might have been
Console.Writeline in an exe rather than a batch file.

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>ctext.com
<snip>

works fine Herbert,
but due to the fact it's a com program doesn't know of other than
standard screen sizes (80*25,80*43,80*50) and flickers annoyingly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top