Microsoft is making the Windows command line a lot better

By Peter Bright

The Windows 7 console didn't support VT codes, so it completely garbles the output of applications that depend on VT codes. The Windows 10 console, however, does support VT codes, making it much more capable.

One of the sore points of the Windows command-line environment is that the command-line windows themselves, the "console" windows, have always been a bit strange. Back in Windows XP, for example, regular Windows apps were themed, with their blobby title bars and bulbous red X button. But command-line windows didn't get the theme; they had a regular Windows title bar and borders. That's because the console windows were "special." A special, rather delicate operating system process drew them, and if that process crashed, your computer would blue screen. So no themes allowed.

Over the last few years, Microsoft has been working to improve the Windows console. Console windows now maximize properly, for example. In the olden days, hitting maximize would make the window taller but not wider. Today, the action will fill the whole screen, just like any other window. Especially motivated by the Windows subsystem for Linux, the console in Windows 10 supports 16 million colors and VT escape sequences, enabling much richer console output than has traditionally been possible on Windows.

Even with this work, however, the Windows console still leaves a lot to be desired when compared to its counterparts on Linux and macOS. Linux in particular has a wide range of console applications offering, for example, tabbed consoles. It also has applications like screen and tmux that allow multiple applications to share the same console. While there are third-party efforts to do the same on Windows (with programs such as ConEmu), they all tend to be quite limited: they work by creating a Windows console window, hiding it somewhere off-screen, and scraping the characters from that console window. This approach isn't robust; command-line applications that try to do complex things (such as showing full screen interfaces) often end up breaking.

But change is afoot. Microsoft is working to build a better console for Windows, one that we hope will open the door to the same flexibility and capabilities that Unix users have enjoyed for more than 40 years. To be clear, this work is changing not the command-line programs themselves, but the text-heavy windows that command-line applications use: PowerShell, cmd, and the Windows subsystem for Linux all use the same console infrastructure, which is why their windows all look the same and have the same features and limitations.

The new and improved APIs seem to be in the latest Windows 10 Insider builds, though documentation is a little scarce for now. The command-line team is publishing a series of blog posts describing the history of the Windows command-line, and how the operating system's console works. The big reveal of the new API is coming soon, and with this, Windows should finally be able to have reliable, effective tabbed consoles, with emoji support, rich Unicode, and all the other things that the Windows console doesn't do... yet.

The blog series is worth checking out if you have any interest in the history, design, and development of Windows. We're still living today with decisions made 30 years ago. Windows does things very differently from Unix—rather than Unix's "everything is a file" approach, Windows' idea is "everything is an object"—and some of these decisions have produced the very different console system that Windows has.