Kodie Dower
All Blogs

Powershell vs CMD (Command Prompt): The Differences and When to Use Them

PowerShell vs CMD

In many ways, the question of using PowerShell vs Command Prompt (CMD) could come down to generational differences. Cmd was originally developed in the 1980’s, whereas PowerShell was introduced in 2006. That’s an eternity in tech and as the (relative) new kid on the block, PowerShell incorporates some additional convenience features, while also introducing a new language that’s easier for users to understand.

As a successor to cmd prompt, PowerShell retains many of its most valuable and basic capabilities. Both are used to execute commands that automate many administrative tasks through scripts and batch files and troubleshoot certain Windows issues. 

The similarities begin to end there, however, as PowerShell’s more powerful command-line shell and scripting language make it the dominant automation engine. For example, this PowerShell tutorial on BitLocker disk encryption demonstrates the relative ease with which PowerShell can be employed using IT management tools like NinjaRMM.

PowerShell Differences

Language and Data Structure

An immediate difference one notices in PowerShell vs cmd is that they are entirely different languages. Commands in PowerShell are known as cmdlets and follow a verb-noun format, making it easier for end-users to understand the output of each command. For example, changing a directory location: 

  • PowerShell cmdlet: Set-Location ” D:\testfolder”. 
  • Cmd prompt command: cd /d D:\testfolder

Each cmdlet can be run separately, but their strength shines when combined to perform complex tasks. Because PowerShell uses pipes, the output of one cmdlet can flow into the next cmdlet, allowing users to chain multiple cmdlets. The way PowerShell can do this is by treating data as “objects,” or structured data. In this way, PowerShell operates akin to a programming language.

A benefit of the way PowerShell’s syntax and data outputs function is that users are able to easily test their scripts in order to avoid mistakenly executed commands. This is in contrast to cmd prompt commands, which must be entered exactly and run the risk of making unchangeable mistakes. But even if you do find that you’d rather use cmd prompt commands for something, PowerShell can run cmd prompt commands, too.

Built-In Support

With the Get-Help cmdlet, PowerShell users can quickly access detailed help articles that explain PowerShell concepts and command syntax. The Get-Help cmdlet can be made more complex and useful by using some of the parameters below:

  • -examples—Displays examples of the cmdlet being executed.
  • -detailed—Displays extensive information regarding the cmdlet.
  • -full—Displays the entire collection of information regarding a cmdlet.
  • -online—Opens the Microsoft TechNet website containing the latest information regarding a cmdlet.

 

Wondering how you can get started with cmdlets? Well, there’s a cmdlet for that, too! By running the Get-Command cmdlet, PowerShell will display a running list of all cmdlets available. This cmdlet can be further narrowed with parameters to find specific commands to perform. Check out Jesus Vigo’s article in TechRepublic for more ideas on getting started with PowerShell.

When to Use PowerShell vs CMD Prompt

For all intents and purposes, Windows users should stick with PowerShell. If you really want to use cmd prompt commands, the PowerShell scripting engine supports many of them and because PowerShell is “safer” (i.e., you’re less likely to accidentally break something), there really aren’t many things you need to use a cmd prompt command for anymore.

Ultimately, sysadmins and technicians should learn PowerShell so they can manage systems more efficiently. The scripting engine makes automating tasks like bulk updates and changing files much easier and more streamlined. In just one example, PowerShell users can use NinjaRMM to remotely uninstall software when either a complex uninstallation process is required on an individual device or if you cannot uninstall an application via other means.

To get started on using PowerShell, watch our on-demand webinar with PowerShell guru Kelvin Tegelaar. For more information on how NinjaRMM can make your IT operations more efficient, sign up for our MSP Bento newsletter and register for the next MSP Live Chat.