Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Windows Command Line Reference Observations

Last week, I posted a blog here entitled “MS Publishes Big Free Command Line Reference.” It explores a revision to Microsoft’s recently revised and re-released command line info ws-commands.pdf. It’s 948 pages long, and documents 270-plus Windows commands. Over the past four days, I’ve conducted an experiment with each of those commands, to make some Windows Command Line Reference observations. In particular, I’ve tried to oberve the following:

  • Commands that work on Windows 10 in both PowerShell and cmd.exe
  • Strings that don’t work in PowerShell, but do work in cmd.exe
  • Commands that don’t work in Windows 10 at all
  • Strings with PowerShell aliases

Making Windows Command Line Reference Observations

Along the way, I also learned something interesting and useful: one can launch the command prompt from inside PowerShell. Simply type cmd or cmd.exe and you’ve got a command line session running inside PowerShell. You can tell by the prompts what’s what, as I show here:

If the prompt starts with PS, it’s PowerShell; if it starts with C:\ (or %SystemDrive%, to be more precise) it’s the command prompt.
[Click image for full-sized view.]

Here’s what I ran (and recorded) for all of the commands in the Command Line Reference:

1. Ran Get-Alias in PowerShell to see if the command had a PowerShell alias. (I counted only 17 unique aliases from the 270-plus commands, over a total of 22 commands.  5 of that total — like cd and chdir — mean the same thing in cmd.exe, and thus also ditto for PowerShell.)

2. Ran the command in PowerShell to see if it worked. (92 commands did not work out of 273, approximately one-third of all commands. Of those 92, 36 aim at Windows Server not Windows client OSes. 15 of the commands are deprecated, of which 13 don’t work on Windows 10 at all.)

3. If it didn’t work in PowerShell, I checked to see if it worked in the command prompt. (12 of those 92 commands worked in the command prompt even though they didn’t work in PowerShell. Some of these are batch file controls such as the shift command.)

All in all, it was a fascinating exercise that showed the majority of commands work with equal facility in PowerShell and the command prompt. For me the biggest benefit was learning that the command prompt inside PowerShell is never more than four keystrokes away (c-m-d-Enter). Just remember to type exit to shell back out into PowerShell when you’re done with cmd.exe!

Next week, I plan to post the complete table of results with additional analysis and lots of links to make things easy to find therein over at Win10.Guru. When I do, I’ll update this post with a link to that article.