Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Windows Console

From Wikipedia, the free encyclopedia
GUI for Windows console applications
Not to be confused withWindows Terminal.

Windows Console
A Windows Console withcmd.exe inWindows 10 20H2
Other namesWin32 console
DeveloperMicrosoft
Written inC++
Operating systemMicrosoft Windows
PlatformIA-32,x86-64,ARM64
TypeTerminal emulator
LicenseMIT License
Websitedocs.microsoft.com/en-us/windows/console/
Repositorygithub.com/microsoft/terminal/tree/main/src/host

Windows Console is aGUI application for runningconsole applications inWindows. Windows Console is used for runningtext-basedprograms such asoperating systemshells (e.g.Command Prompt andPowerShell),utilities (e.g.Far Manager) and some, generally older,applications (e.g.Midnight Commander).

Windows Terminal was introduced inWindows 10 as a replacement for Windows Console.[1] In 2019, the console host wasopen-sourced under theMIT License, alongside Windows Terminal.[2]

Use

[edit]

Full-screen mode

[edit]
Windows PowerShell onWindows Vista
Midnight Commander usingbox-drawing characters

Windows Console runs in either window or full-screen mode. The mode can be toggled by pressingAlt+↵ Enter.

In window mode, the console writes text in awindow and uses an operating system'sfont rendering. In this mode, an application'suser interaction is controlled by the windowing system, analogous toX Window System applications such asxterm.

InWindows XP and earlier, the full-screen console uses ahardware text mode and uploads araster font to thevideo adapter, analogous to a text-basedsystem console. This early full-screen mode only supports VGA-compatible text modes, giving it a maximum characterresolution of 80columns by 28 rows.[3] This mode was removed inWindows Vista,[4] although untilWindows 8, it was possible to circumvent this issue by installing a Windows XP display driver.[4][5]

Windows 10 features a full-screen mode once again. The implementation uses the native Windows rendering subsystem instead of the text mode, and supports rows and columns to fill the screen.[6]

Programmatic access

[edit]

A program may programmatically interact with its host console via theWindows API, which exposes both high-level functions (such asReadFile,ReadConsole,WriteFile, andWriteConsole) and low-level functions (e.g.ReadConsoleInput andWriteConsoleOutput).[7]

Fonts and colors

[edit]

A user can configure the consolefont orcolor palette, either system-wide or at the application level. An instance of a console application, however, cannot change its font or color palette on the fly.

Distinction from DOS

[edit]

A console application is distinct from anMS-DOS application, even though on Windows (especially onWindows 9x), they may not look different. A console application has access to theWindows API and does not run on MS-DOS or compatible systems. A DOS application cannot access the Windows API and only runs on a 32-bit version of Windows with the aid ofVirtual DOS machine (VDM).

Design

[edit]

Input/output buffering

[edit]

An instance of a Windows Console has ascreen buffer and aninput buffer. The input buffer is a queue where events are stored (fromkeyboard,mouse 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.

Implementations

[edit]

InWindows 3.1 and earlier, there is no native support for consoles. Because those version 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 ofVisual C++ are supplied withQuickWin, a library that implements basic console functionality inside a regular window. A similar library forBorland C++ was calledEasyWin.

Windows 9x

[edit]
Command.com running in a Windows console onWindows 95

Windows 9x support is relatively poor compared toWindows NT, because the console window runs in the systemvirtual DOS machine and so keyboard input to a Win32 console application had to be directed to it byconagent.exe running in a DOS VM that are also used for real DOS applications by hooking the keyboard interrupt.conagent.exe then callsVcond (which is aVxD).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 ofVGA text buffer, with two bytes per character cell: one byte for character code, one byte for attributes (the character must be inOEM character set, 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

[edit]
TheWindows Subsystem for Linux runningBash onWindows 10
Cmd.exe running onWindows CE 3.0

Traditionally, theClient/Server Runtime Subsystem (CSRSS) has been responsible for managing console windows on theWindows NT family of operating systems.[8] InWindows 7, CSRSS spawns oneconhost.exe for each console window, to manage it. InWindows 8 and later, the console applications spawn theirconhost.exe processes directly. This change has both security and usability implications. While CSRSS runs in a highly privileged security context, eachconhost.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 theAero Glass theme.[9]

On Windows NT andWindows CE, 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 ofUnicode (UCS-2).[10] For backward compatibility, the console APIs exist in two versions: Unicode and non-Unicode. The non-Unicode versions of APIs can usecode page switching to extend the range of displayed characters (but only ifTrueType fonts are used for the console window, thereby extending the range of codes available). EvenUTF-8 is available as "code page 65001"[11] (displaying only from the UCS-2 subset of full Unicode[citation needed]).

As of theWindows 10 October 2018 update, the Windows Console has full Unicode support.[12]

See also

[edit]

References

[edit]
  1. ^Cinnamon, Kayla (May 6, 2019)."Introducing Windows Terminal". Microsoft Corporation. RetrievedNovember 20, 2020.
  2. ^Cinnamon, Kayla (May 6, 2019)."Introducing Windows Terminal".Windows Command Line Tools For Developers.Microsoft. RetrievedMay 10, 2019.
  3. ^Julio Sanchez; Maria P. Canton (2003), "VGA Fundamentals, Part II: DOS Graphics",The PC Graphics Handbook (for C++ Programmers) (Book), CRC Press, p. 125,ISBN 0849316782
  4. ^ab"Some 16-bit DOS-based Programs and the Command Prompt will not run in full-screen mode in Windows Vista and in Windows 7".Support. Microsoft. September 23, 2011.
  5. ^"Roadmap for Developing Drivers for the Windows 2000 Display Driver Model (XDDM)".Windows Dev Center - Hardware.Microsoft. November 16, 2013. RetrievedDecember 16, 2013.XDDM and VGA drivers will not compile on Windows 8 and later versions
  6. ^Tkachenko, Sergey (November 24, 2014)."Open command prompt fullscreen in Windows 10".Winaero. RetrievedJuly 31, 2019.
  7. ^"Console Modes".Windows Console documentation.Microsoft. RetrievedOctober 13, 2020 – via Microsoft Docs.
  8. ^Microsoft Security Advisory (930181): Exploit Code Published Affecting Windows Client Server Run-Time Subsystem
  9. ^Yosifovich, Pavel; Ionescu, Alex; Russinovich, Mark E.; Solomon, David A. (May 15, 2017).Windows Internals, Part 1: System architecture, processes, threads, memory management, and more (7th ed.). Redmond, Washington: Microsoft Press. p. 67.ISBN 9780735684188.
  10. ^"Console Reference". Microsoft. 2009. RetrievedJanuary 1, 2010.
  11. ^"Release Notes".docs.microsoft.com. June 27, 2022.Console: Fix for no output text being displayed in codepage 65001 (utf8)
  12. ^Turner, Rich (November 15, 2018)."Windows Command-Line: Unicode and UTF-8 Output Text Buffer".Windows Command Line Tools For Developers. Microsoft. RetrievedJune 14, 2019.

External links

[edit]
Graphics and UI
Audio
Multimedia
Web
Data access
Networking
Communication
Administration and
management
Component model
Libraries
Device drivers
Security
.NET
Software factories
IPC
Accessibility
Text and multilingual
support
Overview
Software
Applications
Video games
Programming
languages
Frameworks,
development tools
Operating systems
Other
Licenses
Forges
Related
Related programs
Management
tools
Apps
Shell
Services
File systems
Server
Architecture
Security
Compatibility
API
Games
Discontinued
Games
Apps
Others
Spun off to
Microsoft Store
Retrieved from "https://en.wikipedia.org/w/index.php?title=Windows_Console&oldid=1328728345"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp