How to change colors of console window?

andy andy at eastonwest.co.uk
Sat Jan 11 07:06:01 EST 2003


On Friday 10 Jan 2003 12:46 am, Bill Walker wrote:

Google "ansi.sys", e.g. http://www.computerhope.com/ansisys.htm

You need to edit your c:\config.sys file to make sure there's a

	DEVICE=C:\WINDOWS\COMMAND\ANSI.SYS  

NOTE: You may need/want to add some parameters at the end of the line.  If you 
change it, you must reboot.

After that's loaded, you can program the ansi display by issuing escape 
commands.  You do this by printing them to the screen.  In DOS batch script,
you use the ECHO command to output text.  There is no way to specify 
non-printable characters, though, so you need to insert them directly.  Any 
GOOD text editor has a meta-key, allowing the insertion of characters that 
would normally be cuaght by the key-bindings.  If you use EDIT.COM, you can 
do this with Ctrl-P:

echo <ctrl>p<esc>(ansi codes...)

Hint: you need to use the Graphics control function...

-regards, 
-andyj

> Can you give an example of using an escape sequence to change the DOS
> windows to, say blue on white?
>
>
> "Cousin Stanley" <CousinStanley at HotMail.com> wrote in message
> news:avi1u6$g4ojc$1 at ID-130333.news.dfncis.de...
>
> > || w98 console is annoying in other ways too, IIRC. I.e., you
> > || have to load doskey to get line recall, and then that doesn't
> > || get inherited when you run python in the console interactively?
> >
> > Bengt ...
> >
> > I'm using doskey and find it very useful
> > and on this Win98 system it does NOT inherit into Python,
> > which  IS  a problem ...
> >
> > As a result, I do little testing directly in interactive mode
> > but make changes in a text editor and then run ...
> >
> > doskey does make switching back and forth
> > between ... edit ... and ... python ... very easy
> > after typing the lines the fist time ...
> >
> > I have managed to switch the DOS colors easily
> > using ANSI Escape sequences with the ANSI.SYS driver,
> > but I'm curious as how to do it with DOS/Win configurations ...
> >
> > Cousin Stanley
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----






More information about the Python-list mailing list