Windows Console
   HOME

TheInfoList



OR:

Windows Console is the infrastructure for
console application A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command-line interface of some operating systems (Unix, DOS, etc.) or the text-based interface included with most gr ...
s in
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. An instance of a Windows Console has a
screen buffer A framebuffer (frame buffer, or sometimes framestore) is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Modern ...
and an input buffer. It allows console apps to run inside a
window A window is an opening in a wall, door, roof, or vehicle that allows the exchange of light and may also allow the passage of sound and sometimes air. Modern windows are usually glazed or covered in some other transparent or translucent materia ...
or in hardware text mode (so as to occupy the entire screen). The user can switch between the two using the key combination. The text mode is unavailable in
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and later. Starting with
Windows 10 Windows 10 is a major release of Microsoft's Windows NT operating system. It is the direct successor to Windows 8.1, which was released nearly two years earlier. It was released to manufacturing on July 15, 2015, and later to retail on J ...
, however, a native full-screen mode is available. Windows Console instances are typically used for apps that do not need to display images but might use color. Examples include
cmd.exe Command Prompt, also known as cmd.exe or cmd, is the default command-line interpreter for the OS/2, eComStation, ArcaOS, Microsoft Windows (Windows NT family and Windows CE family), and ReactOS operating systems. On Windows CE .NET 4.2, Windo ...
,
Windows PowerShell PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-so ...
,
Far Manager Far Manager (short for ''File and ARchive Manager'') is an orthodox file manager for Microsoft Windows and is a clone of Norton Commander. Far Manager uses the Win32 console and has a keyboard-oriented user interface (although limited mouse o ...
, and
Midnight Commander GNU Midnight Commander (also known as mc, the command used to start it, and as mouseless commander in older versions) is a free cross-platform orthodox file manager. It was started by Miguel de Icaza in 1994 as a clone of the then-popular Nor ...
. In 2019, the Windows Console infrastructure was open-sourced under the
MIT License The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license comp ...
, alongside
Windows Terminal Windows Terminal is a multi-tabbed terminal emulator that Microsoft has developed for Windows 10 and later as a replacement for Windows Console. It can run any command-line app in a separate tab. It is preconfigured to run Command Prompt, Pow ...
.


Window and full screen modes

In Windows, a console application may run in two modes. One mode places the text in a
window A window is an opening in a wall, door, roof, or vehicle that allows the exchange of light and may also allow the passage of sound and sometimes air. Modern windows are usually glazed or covered in some other transparent or translucent materia ...
and uses an operating system's
font rendering Font rasterization is the process of converting text from a vector description (as found in scalable fonts such as TrueType fonts) to a raster or bitmap description. This often involves some anti-aliasing on screen text to make it smoother and ...
. In this mode, an application's interaction with user is controlled by the windowing system. This is analogous to
X Window System The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wit ...
applications such as
xterm In computing, xterm is the standard terminal emulator for the X Window System. It allows users to run programs which require a command-line interface. If no particular program is specified, xterm runs the user's shell. An X display can sho ...
. The second is the full-screen mode. In
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
and earlier, the full-screen console uses a hardware text mode and uploads a
raster font A computer font is implemented as a digital data file containing a set of graphically related glyphs. A computer font is designed and created using a font editor. A computer font specifically designed for the computer screen, and not for print ...
to the
video adapter A graphics card (also called a video card, display card, graphics adapter, VGA card/VGA, video adapter, display adapter, or mistakenly GPU) is an expansion card which generates a feed of output images to a display device, such as a computer mo ...
. This is analogous to a text
system console One meaning of system console, computer console, root console, operator's console, or simply console is the text entry and display device for system administration messages, particularly those from the BIOS or boot loader, the kernel, from the ...
. This early full-screen mode only supports VGA-compatible text modes, giving it a maximum character
resolution Resolution(s) may refer to: Common meanings * Resolution (debate), the statement which is debated in policy debate * Resolution (law), a written motion adopted by a deliberative body * New Year's resolution, a commitment that an individual mak ...
of 80
columns A column or pillar in architecture and structural engineering is a structural element that transmits, through compression, the weight of the structure above to other structural elements below. In other words, a column is a compression membe ...
by 28 rows. This mode was deprecated in
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
. It was possible to circumvent this issue by installing a Windows XP display driver; however,
Windows 8 Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012; it was subsequently made available for downl ...
and later do not accept them. Windows 10 features a full-screen mode once again, but this implementation uses the native Windows rendering subsystem, instead of the text mode. It can have as many columns and rows as fits on the screen. Apps can be made to switch between the two modes using the key combination.


Details

The input buffer is a queue where events are stored (from
keyboard Keyboard may refer to: Text input * Keyboard, part of a typewriter * Computer keyboard ** Keyboard layout, the software control of computer keyboards and their mapping ** Keyboard technology, computer keyboard hardware and firmware Music * Musi ...
,
mouse A mouse ( : mice) is a small rodent. Characteristically, mice are known to have a pointed snout, small rounded ears, a body-length scaly tail, and a high breeding rate. The best known mouse species is the common house mouse (''Mus musculus' ...
etc.). The output buffer is a rectangular grid where characters are stored, together with their attributes. A console window may have several output buffers, only one of which is active (i.e. displayed) for a given moment. Apps may programmatically interact with Windows Console through
Windows API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
, which exposes both high-level functions (such as ReadConsole and WriteConsole) and low-level functions (e.g. ReadConsoleInput and WriteConsoleOutput). Users can change the color palette or
font In metal typesetting, a font is a particular size, weight and style of a typeface. Each font is a matched set of type, with a piece (a "sort") for each glyph. A typeface consists of a range of such fonts that shared an overall design. In mod ...
, either on the system-wide level or app-level. Each instance of a console app themselves, however, cannot change its color palette or font on the fly. Windows Console apps are distinct from
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
apps, even though on Windows (especially on
Windows 9x Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced from 1995 to 2000, which were based on the Windows 95 kernel and its underlying foundation of MS-DOS, both of which were updated in subs ...
), they may not look different. Windows Console apps have access to entire
Windows API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
and do not run on MS-DOS or compatible operating systems. DOS apps, however, cannot access Windows API and may only run on 32-bit versions of Windows with the aid of
Virtual DOS machine Virtual DOS machines (VDM) refer to a technology that allows running 16-bit/32-bit DOS and 16-bit Windows programs when there is already another operating system running and controlling the hardware. Overview Virtual DOS machines can operate eit ...
(VDM).


Implementations

Prior to
Windows 95 Windows 95 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of operating systems. The first operating system in the 9x family, it is the successor to Windows 3.1x, and was released to manufacturi ...
, there is no native support for consoles. Because
Windows 3.1 Windows 3.1 is a major release of Microsoft Windows. It was released to manufacturing on April 6, 1992, as a successor to Windows 3.0. Like its predecessors, the Windows 3.1 series ran as a shell on top of MS-DOS. Codenamed Janus, Windows 3 ...
and earlier are merely a graphical interface for MS-DOS, most text programs that ran on earlier Windows versions were actually MS-DOS programs running in a window. To simplify the task of porting applications to Windows, early versions of
Visual C++ Microsoft Visual C++ (MSVC) is a compiler for the C, C++ and C++/CX programming languages by Microsoft. MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available in both tri ...
are supplied with QuickWin, a library that implements basic console functionality inside a regular window. A similar library for
Borland C++ Borland C++ is a C and C++ IDE (integrated development environment) for MS-DOS and Microsoft Windows. It was the successor to Turbo C++ and included a better debugger, the Turbo Debugger, which was written in protected mode DOS. Libraries O ...
was called EasyWin.


Windows 9x

Windows 9x Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced from 1995 to 2000, which were based on the Windows 95 kernel and its underlying foundation of MS-DOS, both of which were updated in subs ...
support is relatively poor compared to
Windows NT Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Win ...
, because the console window runs in the system
virtual DOS machine Virtual DOS machines (VDM) refer to a technology that allows running 16-bit/32-bit DOS and 16-bit Windows programs when there is already another operating system running and controlling the hardware. Overview Virtual DOS machines can operate eit ...
and so keyboard input to a Win32 console application had to be directed to it by conagent.exe running in a DOS VM that are also used for real DOS applications by hooking the keyboard interrupt. conagent.exe then calls Vcond (which is a
VxD VxD is the device driver model used in Microsoft Windows/386 2.x, the 386 enhanced mode of Windows 3.x, Windows 9x, and to some extent also by the Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 (and higher) multitasker (TASKMGR). VxDs have acc ...
). Vcond then had to pass the keyboard input to the System VM, and then finally to the Win32 console application. Besides performance, another problem with this implementation is that drives that are local to a DOS VM are not visible to a Win32 console application. This can cause confusion. Under Windows 9x, the screen buffer mirrors the structure of VGA text buffer, with two bytes per character cell: one byte for character code, one byte for attributes (the character must be in
OEM character set Windows code pages are sets of characters or code pages (known as character encodings in other operating systems) used in Microsoft Windows from the 1980s and 1990s. Windows code pages were gradually superseded when Unicode in Microsoft Windows, Un ...
, the attribute is with high-intensity background/no blinking). This speeds up operation considerably if the actual VGA text mode is used.


Windows NT and Windows CE

Traditionally, the
Client/Server Runtime Subsystem Client Server Runtime Subsystem, or csrss.exe, is a component of the Windows NT family of operating systems that provides the user mode side of the Win32 subsystem and is included in Windows NT 3.1 and later. Because most of the Win32 subsystem ope ...
(CSRSS) has been responsible for managing console windows on the
Windows NT family Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Wind ...
of operating systems. In
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
, CSRSS spawns one conhost.exe for each console window, to manage it. In
Windows 8 Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012; it was subsequently made available for downl ...
and later, the console apps spawn their conhost.exe processes directly. This change has both security and usability implications. While CSRSS runs in a highly privileged security context, each conhost.exe runs in the same security context as the console app. In addition, in Windows 7, this change enabled console windows to have the features of the Aero Glass theme. On Windows NT and
Windows CE Windows Embedded Compact, formerly Windows Embedded CE, Windows Powered and Windows CE, is an operating system subfamily developed by Microsoft as part of its Windows Embedded family of products. Unlike Windows Embedded Standard, which is base ...
, the screen buffer uses four bytes per character cell: two bytes for character code, two bytes for attributes. The character is then encoded in a 16-bit subset of
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
(
UCS-2 The Universal Coded Character Set (UCS, Unicode) is a standard set of characters defined by the international standard ISO/IEC 10646, ''Information technology — Universal Coded Character Set (UCS)'' (plus amendments to that standard), whi ...
). For backward compatibility, the console APIs exist in two versions: Unicode and non-Unicode. The non-Unicode versions of APIs can use code page switching to extend the range of displayed characters (but only if
TrueType TrueType is an outline font standard developed by Apple in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript. It has become the most common format for fonts on the classic Mac OS, macOS, and Microsoft Windows operating sy ...
fonts are used for the console window, thereby extending the range of codes available). Even
UTF-8 UTF-8 is a variable-width encoding, variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit'' ...
is available as "code page 65001" (displaying only from the UCS-2 subset of full Unicode). As of the
Windows 10 Windows 10 is a major release of Microsoft's Windows NT operating system. It is the direct successor to Windows 8.1, which was released nearly two years earlier. It was released to manufacturing on July 15, 2015, and later to retail on J ...
October 2018 update, the Windows Console has full Unicode support.


See also

* Comparison of terminal emulators *
Command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
*
Shell (computing) In computing, a shell is a computer program that exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending ...
*
System console One meaning of system console, computer console, root console, operator's console, or simply console is the text entry and display device for system administration messages, particularly those from the BIOS or boot loader, the kernel, from the ...
*
Windows Terminal Windows Terminal is a multi-tabbed terminal emulator that Microsoft has developed for Windows 10 and later as a replacement for Windows Console. It can run any command-line app in a separate tab. It is preconfigured to run Command Prompt, Pow ...
*
Linux console The Linux console is a system console internal to the Linux kernel. A system console is the device which receives all kernel messages and warnings and which allows logins in single user mode. The Linux console provides a way for the kernel and ...
*
Text-based (computing) In computing, text-based user interfaces (TUI) (alternately terminal user interfaces, to reflect a dependence upon the properties of computer terminals and not just text), is a retronym describing a type of user interface (UI) common as an ear ...
*
List of formerly proprietary software This is a list of notable software packages which were published under a proprietary software license but later released as free and open-source software, or into the public domain. In some cases, the company continues to publish proprietary rel ...


References


External links


Windows Console documentation''Windows Command-Line: Backgrounder'' blog
{{Windows Components Formerly proprietary software Free and open-source software Free terminal emulators Microsoft free software Software using the MIT license Text user interface Windows administration Windows-only free software