Configure Console Application through Registry

By | May 9, 2020

There are several ways to change console appearance: programmatically and/or using registry setting. When it is done programmatically application care itself about own size, font or colors. Registry settings instruct Windows OS what console properties are applied to application during its startup. The registry approach gives possible to change console presentation without alter the code. When console application is started with default settings or setting saved in HKCU\Console\the_application key, where “the_application” is the path to the console executable.

Here is simple console application:

using System;
using System.Collections.Generic;
using System.Text;
namespace WhiteConsole
   class Program
      static void Main(string[] args)
         Console.WriteLine(“Hello White Background!\n\nPress any key to exit!”);

I want that the application console has white background and black font color, opposite that normal command prompt has, like this:
Command prompt with white background
How to do it without changing the code?
Add additional key under HKCU/Console which specifies full path to your console application, back-splashed symbols should be replaces with underscore symbols, if directories or file name have spaces in their name keep it as is:
Registry settings for console appliacation
Add double word ScreenColors value with data 0x000000f0, where the higher 4 bit specifies background color and lower 4 bit font color.
Now if you start application using from Run dialog
Run dialog
or from File Explorer you will see console windows as presented above.
However if application is launched from command prompt it inherits console properties from parent command prompt window and appearance will be different.
It is only minor demonstration of customization of console application through registry setting, there are a lot of other values which change console presentation, there are a lot of sites which explain these values, for example this one.

Leave a Reply

Your email address will not be published. Required fields are marked *