Computing.Net > Forums > Programming > set color in batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

set color in batch

Reply to Message Icon

Name: Code One
Date: January 12, 2004 at 13:00:34 Pacific
OS: ME
CPU/Ram: pent3-256mb
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Daemon Rose
Date: January 12, 2004 at 13:19:16 Pacific
Reply:

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


0

Response Number 2
Name: Code One
Date: January 12, 2004 at 15:01:41 Pacific
Reply:

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



0

Response Number 3
Name: Dr. Nick
Date: January 12, 2004 at 20:11:26 Pacific
Reply:

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 White

If 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.


0

Response Number 4
Name: Code One
Date: January 12, 2004 at 20:35:39 Pacific
Reply:

Wont work please reffer to this thread:

Click Me


0

Response Number 5
Name: zintazu
Date: January 13, 2004 at 00:55:55 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: Code One
Date: January 13, 2004 at 09:35:02 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Kill Processess STL String to BYTE*



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: set color in batch

(ME)Set Color in DOS Prompt (How2) www.computing.net/answers/programming/meset-color-in-dos-prompt-how2/9122.html

Date Routines in Batch Files www.computing.net/answers/programming/date-routines-in-batch-files/15590.html

Nesting variables in batch files ? www.computing.net/answers/programming/nesting-variables-in-batch-files-/14334.html