Link to home
Start Free TrialLog in
Avatar of Kyle Olderog
Kyle OlderogFlag for United States of America

asked on

Create Batch File with Color in it

I am in need of a little help creating a batch file that has color in it.  Below is the batch file that works just fine.  The person that is requesting this batch file would like the following in color so it stands out to the end user.

(This password is the one you use to log into your comptuer with.  Please  add xxx before your user name (example: xxx\username) then press enter.  You  will then be prompted for your password)

I have found out that I can change the whole screen differant colors, but I only what the above part in color.  Can this be done?

net use U: /delete
ECHO OFF
 ECHO  (This password is the one you use to log into your comptuer with.  Please  add xxx before your user name (example: xxx\username) then press enter.  You  will then be prompted for your password)
ECHO.
ECHO.  
ECHO.
 
net use U: "\\servername\shares\sharename" /persistent:yes
Avatar of MoreHeroic
MoreHeroic

How about something like this?  It should flash white for a brief second while that text is printed then everything goes back to whatever the batch file started as.

net use U: /delete
@ECHO OFF
COLOR f0
ECHO  (This password is the one you use to log into your comptuer with.  Please  add xxx before your user name (example: xxx\username) then press enter.  You  will then be prompted for your password)
COLOR
ECHO.
ECHO.  
ECHO.
pause
 
net use U: "\\servername\shares\sharename" /persistent:yes
Here is the list of colors:
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

Use:  COLOR  xx

One character specifies text. If used with 2, the first is background, then text.

To reset, use COLOR without parameters.
Avatar of Steve Knight
I do it as follows in a few scripts.  You can add a couple of Control G's to sounds a sounds too in the echo commands (use edit and enter them with Control P Control G.

Steve

@echo off
REM save as 1.cmd or whatever.  Change path to point to second batch
START /WAIT cmd /c c:\2.cmd
echo Continuing

@echo off
REM Save as 2.bat or change reference in above file
color cf
mode con: cols=80 lines=5
cls
echo This is the message to pop up
pause
exit
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kyle Olderog

ASKER

Thanks for your help all seems to be working