I still remember the “magicians” of the DOS era. Those folks who created their colorful prompts or unimaginable graphics for the time (special characters and symbols lost in almost forgotten code pages). I recall when a colleague bought MS DOS 5.0 and we spent an afternoon setting up the page 850. The manual said that Portuguese accents would only appear correctly on this page. It was all very simple, just a few lines in the CONFIG.SYS and others in the AUTOEXEC.BAT. Yes, Word was text mode. Then we discovered that the keyboard also had to be configured… more lines in the AUTOEXEC.BAT. Of course, nothing of this resolved the problem of printing accents on the printer, it was another battle!

But it was already a victory to have capitals and lowercase… something optional in the 80s… accents were luxury :-)

The magicians’ book was the MS DOS manual. A rare thing because at that time many people didn’t know that this was sold. Software still came with printed manuals, and few read them. Those who read became mythical beings, capable of dominating DOS and other dinosaurs of the time like SCO.

After that, I got a mouse, but I thought it would only serve for drawing :-D But I was wrong. The mouse and GUIs would kill the console in no time. It was the 90s… Windows 3… weird things from back then. At least using my colleague’s Amiga with games and the powerful Amiga OS was fun. On the PC, it was only DOS and the Windows that ran on DOS. Consuming so much memory (RAMs of 1MB, HDs of 10 MB were common) that there wasn’t enough space for anything else, QEMM would say. My computer didn’t run Word for Windows because it was an AT 286, but Windows wrapped itself around it… with the Windows 3.1 I got a 486, 4MB of RAM and finally could run Word for Windows! Before that, I enjoyed the sophistication of write.exe… printed accents on any printer and documents with letter quality (that’s old!)

But the console would continue to reign until Windows 95.

Today, with web applications and Web 2.0, the console lost its charm. Console only on an old pharmacy system or gas station. Fossilized written in Clipper. I still use it every day on Linux, Mac, and Ruindows, people don’t change easily. The era of the console is over, but what a pain, help me out.

I tried to write scripts with colored output in Python. I discovered that there are several libraries for this, but multi-platform ones didn’t find any. Of course, who still works with that?

Curses, WConio and small scripts abound, but they all need C modules that are quite annoying to distribute with the script, especially on Ruindows.

I ended up writing a small module to change colors, clear the screen, and configure the console or xterm title. So far it’s working on Linux and Mac, but Windows is still missing. On the Windows console there’s not much to do except using ctypes to call some functions from kernel.dll. Despite using ctypes, you can mask the initialization according to the operating system and make everything in Python.

I ended up creating an open-source project for this. At least I won’t forget the work it took me, nor have to back up myself. I’ll put the sources here: http://code.google.com/p/colorconsole/

Digging into this almost forgotten art, I found out how to change the default prompt of the Windows XP console. It’s quite simple, like everything in Windows:

  1. You open regedit

  2. Look for the key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\]

  3. Create a string entry with the name PROMPT

  4. Type your new prompt, for example: [%computername%]$S$P$G

  5. Log off and log in, of course, or else it wouldn’t be old XP :-)

  6. If everything worked out, your default Windows console prompt was changed!

Here are the step-by-step instructions here.

If you still use cmd.exe every day, it’s worth installing “Open Command Window Here” on the Windows Explorer. A Microsoft power toy that can be downloaded here. As they change their site every 4 hours, it’s better to search for it on Google.