Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hey,
How do I set the color in my batch apps?Do I have to first make an ansi file and then call it within the bat file which will be set to change whatever color scheme i choose?
if so what is the syntax to do so?
if not what the heck do i gotta do?
I see some peoples bat files that they in turn converted into exe files and they have color in there apps, and I really want to know how they do that...
all help most appreciated
co

Hey Code One, never written a batch to do this, but I hope this link for setting colors in dos will help.
http://64.70.165.184/vfrazee/nowonder/ansi_how.htm

well, it gave me a start but i was abruptly haulted by an article i found that said that M$ stopped the use of the config.sys file to run in real-dos mode and anything you put in it will be defaulted back to nothing, even if you go and change it's reg values after the reboot it too is defaulted back to nothing.
so does anyone know of a work around to make the config.sys file load ansi.sys, so i can display colors in my batch apps?
thanks

On WinXP Pro SP1:
=========================================================
C:\>color /?
Sets the default console foreground and background colors.COLOR [attr]
attr Specifies color attribute of console output
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright WhiteIf no argument is given, this command restores the color to what it was
when CMD.exe started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.Example: "COLOR fc" produces light red on bright white
=========================================================
Just put this at the beginning of your batch:
@COLOR 0A
See if that works for you.

Hi,
One of the easy ways to make colors on both cmd.exe and plain good old dos. is using the wbat util form Horst Schaeffer's webpage
http://home.mnet-online.de/horst.muc/
Works great.
WBAT : Dialog boxes with menues, buttons, checkboxes, radio buttons and input fields for GUI window or full screen DOS. Win NT/2000(XP) compatible.

hey,
first off I appreciate the help big time...so thanks alot for posting your tips and ideas.
unfortunatly I use ME...
but have found a way to do it with .COM files, it isnt as great as ansi since the colors are limited but still Im happy with the results.
again though thanks to everyone who posted.
code one

![]() |
Kill Processess
|
STL String to BYTE*
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |