Search notes:

conhost.exe

Console Windows Host
The console host controls the appearance and functionality of character mode applications such as cmd.exe or PowerShell. Such character mode applications are also referred to as consoles.

Screen Buffer and Console Window

The screen buffer is a two-dimensional array that stores characters and their foreground and background color.
The console window is a rectangular window that provides a view onto the screen buffer. If the size of the console window is smaller than the screen buffer, vertically, horizontally or both, the console displays scrollbars which allow to view different parts of the screen buffer.
The cursor displays the special position in the screen buffer where text is written to or read from.
The cursor can be made hidden. If it is visible, the console window is always moved so that the cursor is visible.

Character encoding / Code pages / Unicode

The console writes and reads text using the current code page.
In order to display Unicode characters, the console must be set to a non-raster or a TrueType font (such as Consolas or Lucida Console).

Creating a conhost.exe child process

In the original Windows subsystem design, console windows were managed by csrss.exe.
This design changed in Windows 7 where for each console (PowerShell or cmd.exe) a separate process (conhost.exe) is spawned as child process.

Configuring settings

The settings of the console host are taken from various places:
A list of settings that can be adjusted is here.
When an application is started through a *.lnk file, the values in the subkey of HKCU\Console are irrelevant.
The menu of an application that uses conhost.exe (such as PowerShell in the following picture) contains the two entries Defaults and Properties.
Choosing Defaults allows to change the settings that are stored in HKCU\Console while Properties allows to change the settings in either the subkey of that registry key or the *.lnk file.

Criteria for fonts

Microsoft lists the following criteria for fonts to be available in a command window. Unfortunately, the original links was gone, but some of the information is in the wayback machine of archive.org:
An unsupported way to add console fonts is by populating the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont whose values consist of the required amount of consecutive 0 (for uniqueness) and font name. The name of the font must be listed in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts. (See also this superuser answer).

See also

Windows Terminal (wt.exe)
The .NET class System.Console
condrv.sys

Links

The Source code for conhost.exe is in this github repository.
Rich Turner on

Index