MS-DOS 6.22 is running. Who needs Windows 10?

I know that upon starting there is a possibility to change the foreground and background color of the MS-DOS environment.

But is this also possible when MS-DOS is already running?

My case is, that I want to run a .BAT file, that then switching the color whether it throws an error or is ok.


There are two possibilities:

  1. You install ANSI.SYS or any other ANSI driver. Then you just write an escape sequence to the screen, e.g. ESC [ 37 ; 44 m, where ESC is the Escape character (0x1b) and without any spaces. This sequence will change the color of the following text to "white on blue". If you can input the ESC character into your BAT file, this works well (try Ctrl+P ESC in DOS EDIT).
  2. You directly change the screen memory at 0xB800. This way you can also change the color of existing text without removing (and rewriting) it first. You probably need an external tool (DEBUG should suffice, though) to be able to change display memory. Also, it probably only works on IBM-PC compatible systems with a CGA-compatible graphics card.
  • I will work on that on Monday, thanks for your response! – Trollwut Aug 7 '15 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.