Command prompt removal has been overly exaggerated

This post is in response to a story published on December 6th 2016 by ComputerWorld titled “Say goodbye to the MS-DOS command prompt” and its follow-up article “Follow-up: MS-DOS lives on after all“.

These “stories” were subsequently picked up by Business Insider and Life Hacker among others and fueled a number of concerned Tweets some of which I responded to directly, along with much discussion on Reddit, Hacker News, and elsewhere. It also resulted in several customers/partners sending me concerned emails asking if this “news” was true.

So, I’d like to take a moment to allay everyone’s fears:

The Windows Cmd / Command-Line shell is NOT being removed from Windows in the near or distant future!

The Cmd shell remains an essential part of Windows, and is used daily by millions of businesses, developers, and IT Pro’s around the world.

In fact:

  • Much of the automated system that builds and tests Windows itself is a collection of many Cmd scripts that have been
    created over many years, without which we couldn’t build Windows itself!
  • Cmd is one of the most frequently run executables on Windows with a similar number of daily launches as File Explorer,
    Edge and Internet Explorer!
  • Many of our customers and partners are totally dependent on Cmd, and all it’s quirks, for their companies’ existence!

In short: Cmd is an absolutely vital feature of Windows and, until there’s almost nobody running Cmd scripts or tools, Cmd will remain within Windows.

So, what was this article actually “reporting”?

The articles above were written in response to this paragraph from the release notes for the Windows 10 Insiders build 14971:

PowerShell in the Shell: In an effort to bring the best command line experiences to the forefront for all power users, PowerShell is now the defacto command shell from File Explorer. It replaces Command Prompt (aka, “cmd.exe”) in the WIN + X menu, in File Explorer’s File menu, and in the context menu that appears when you shift-right-click the whitespace in File Explorer. Typing “cmd” (or “PowerShell”) in File Explorer’s address bar will remain a quick way to launch the command shell at that location. For those who prefer to use Command Prompt, you can opt out of the WIN + X change by opening Settings > Personalization > Taskbar, and turning “Replace Command Prompt with Windows PowerShell in the menu when I right-click the Start button or press Windows key+X” to “Off“.

Notice the nuance here:

The above paragraph states that “[PowerShell] replaces Command Prompt (aka, “cmd.exe”) in the WIN + X menu, in File Explorer’s File menu“.

It does not say “[PowerShell] replaces Command Prompt“, period! The paragraph even goes on to show you how to quickly launch Cmd, and points out that you can revert this default setting to launch Cmd by default instead if you prefer.

So, to be ultra-clear here: All that’s happening is that, in the [Win] + [X] (“Power User’s menu”), or File Explorer’s File menu, PowerShell is presented instead of Cmd. That’s all! Nothing is being removed, your scripts will continue to run just as they always have, the sky is not falling! ?

Also, Cmd != MS-DOS!

I also want to point out a common misconception perpetuated by articles like the ones above: Cmd <> MS-DOS!

In FACT:

  • Microsoft last shipped a “new” version of MS-DOS (v8.0 in Windows ME), on September 16th, 2000 – 16 years ago (as of this writing)!!
  • MS-DOS was an operating system (albeit a relatively simple OS by today’s standards) whose primary user-interface was a command-line shell, until Windows 3.x & 9.x arrived and ran on/around MS-DOS
  • MS-DOS’ command-line shell’s scripting language was relatively terse and moderately powerful, but lacked many of the richer, and more advanced features we enjoy in modern-day PowerShell, Bash, etc.
  • While later versions of MS-DOS grew in sophistication and added/replaced some older assembly with new code written in ‘C’, much of MS-DOS remained written in x86 assembly for efficiency, and because it was the only way at the time to gain access to many hardware devices and peripherals. This made MS-DOS non-portable to non-x86 CPU’s. If you’re so inclined, you can actually download the source code for MS-DOS v1.1 and v2.0 to see just how much of the earlier versions of MS-DOS were written in x86 assembly (hint: pretty much all of it)!

Interesting note: 32-bit versions of Windows derived from NT include an additional shell “command.com” which runs many MS-DOS scripts and legacy 16-bit apps in a Windows NT Virtual DOS Machine (NTVDM) using the x86 Virtual 8086 mode along with some legacy “quirks”. 64-bit versions of Windows do not include command.com or the NTVDM.

On the other hand:

  • Cmd is a Win32 app written entirely in ‘C’ – this is important since one of the key goals of NT was to be portable across many different processor and machine architectures
  • Cmd is the default command-line shell built-in to the Windows NT family of OS’ (i.e. Windows NT, 2000, XP, Vista, 7, 8, 10)
  • The Cmd scripting language was designed to be generally compatible with many MS-DOS scripts, to help users migrate from MS-DOS and Windows 9x/ME to the new NT-based OS family, but lacks many MS-DOS features since it is a Win32 shell running atop the Windows NT kernel and OS
  • Cmd is used to automate millions of businesses’ login scripts, shop floor/manufacturing systems, data capture systems, etc., and millions of developers’ build, test and deployment systems, etc.

So why the move to default to PowerShell?

Cmd has served us all well for almost 30 years now, and will continue to do so for a long time to come. But, WHILE CMD IS NOT BEING REMOVED FROM WINDOWS ANYTIME SOON (if ever), the reality is that PowerShell is a far, FAR more powerful shell than Cmd could ever be. Hence PowerShell’s name. Surprise! ?

We’ve gotten to the point with Cmd that we can no longer easily make improvements, enhancements or modifications to it! On the very rare occasions where we do make a fix, or change something, we generally break someone in the real world whose scripts/tools depend on that legacy feature/behavior. The last thing we want to do is break the Windows build system (that team get really upset when we break them ?), or worse, break a PC OEM’s production line, or damage a farm equipment manufacturer’s welding robots, or prevent an enterprise’s 150,000+ employees from logging-in to their PC’s in the morning! This also means it is tricky to add new usability features such as auto-complete, color highlighting, etc.: If we change Cmd, we tend to break someone!

PowerShell, on the other hand, is much newer than Cmd and was built for today and the future. In fact, PowerShell celebrated its 10th birthday on October 25th 2016! It ably handles the rigors of the most demanding scripting environments on earth today and is highly extensible, flexible and … well … powerful! It was also recently open-sourced and ported to run on Linux, and is the backbone of the cross-platform Desired State Configuration (DSC) cross-platform declarative configuration initiative.

PowerShell’s full syntax is seen by some as “verbose”, esp. compared to some of the more “terse” Linux command-line tools (e.g. ‘tar xvzf file-1.0.tar.gz’ … whut?). However, PowerShell was built specifically for long-term readability and discoverability (PowerShell’s tab completion is AWESOME).

If you don’t enjoy typing the longer commands, PowerShell makes it is easy to create your own shorter aliases (using the “set-alias” command), and scriptlets for more complex/verbose PowerShell operation. PowerShell also pre-defines a set of convenient aliases to abbreviate many common commands (run “get-alias” for the full list), along with aliases for common *NIX commands, e.g.: ls == get-childitem.

Now that we’re seeing an ever increasing number of developers and IT admins (the primary users of shells) use PowerShell, we wanted to give them the ability to launch PowerShell as their default shell, instead of Cmd, while still allowing them to revert back to Cmd by default if they’re not yet ready to move to PowerShell.

Hence the changes in Windows 10 Creator Update’s UI, noted above.

In closing

I hope this post clears-up any last remaining concerns, fears, worries, confusion you may have about Microsoft’s commitment to Cmd and the UI changes we’re making to Windows 10 Creator Update, to help you find and use PowerShell more often, while still allowing you to revert back to Cmd as your default shell should you wish.

If you do see anyone claiming that Cmd is being removed from Windows, please reply with one or more of “No! Nope! Niet! Non! Negative! Nuh-huh! [Shake head vigorously], etc.”, and refer them to this post. Thanks!

Source: Microsoft Developer