Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I haven use Dos Command for a very long time & now forget whats are the command for background and text color.
I have load device=c:\windows\command\ansi.sys in CONFIG.SYS
But how do I make colors using batch file.Any Ideas Guys

hi
i have lot of problem with batch.bat file as i am new to it so pls give the solution for " how to color my dos batch file
reply soon
sameer

Hi out there: use my code (copy it into a .bat-file)
@echo off
if "%1"=="/?" goto USAGE
if "%1"=="black" set Textf=30
if "%1"=="red" set Textf=31
if "%1"=="green" set Textf=32
if "%1"=="yellow" set Textf=33
if "%1"=="blue" set Textf=34
if "%1"=="lred" set Textf=35
if "%1"=="lblue" set Textf=36
if "%1"=="white" set Textf=37if "%2"=="black" set Hintf=40
if "%2"=="red" set Hintf=41
if "%2"=="green" set Hintf=42
if "%2"=="yellow" set Hintf=43
if "%2"=="blue" set Hintf=44
if "%2"=="lred" set Hintf=45
if "%2"=="lblue" set Hintf=46
if "%2"=="white" set Hintf=47prompt $e[%Textf%;%Hintf%m$p$g
cls
goto end:USAGE
echo.
echo ndert die Farben von MS-DOS
echo.
echo syntax: COLOUR [Colour1] [Colour2]
echo.
echo Colour1: Farbe fr die Textausgabe
echo Colour2: Farbe fr den Hintergrund
echo.
echo Mgliche Farben fr Colour1, Colour2:
echo.
echo black, red, green, yellow, blue,
echo lblue, lred, white
echo.:end

@PROMPT $E[31;44m [DRS-ME] $P$G
This in autoexec will give a blue background with red lettering and will display your current dir with DRS-ME as a prompt
The numbers 31 & 44 control the colors
valide numbers are 30 thru 35 and 40 thru 45

![]() |
![]() |
![]() |

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