CMD is also known as the Command Shell. In fact, people most often refer to it as just ‘command’. It’s a tool within Windows that allows users to perform tasks by typing letters and words. For the more experienced readers, you may recall this as MS-DOS commands. MS-DOS comes from MicroSoft Disk Operating System. Those commands are housed in a file called command.com, tucked deep inside of Windows. You’ll also find that some commands in the command shell invoke small programs. Open Windows Explorer and go to C:\Windows\System32. Look at all the applications in there. Most of them have the same names as many of the different commands. You’ll see tracert.exe, taskkill.exe, whoami.exe, and more. If you know the different commands and how to use them, it’s often a far quicker way to get things done. But be careful! It’s also a powerful tool that can cause severe issues in Windows if you make a mistake or don’t know what you’re doing. PowerShell is a command line utility, but also an entire scripting language built on Microsoft’s .NET platform. It has all the power and capabilities of CMD, and much more. PowerShell allows you to interact with every facet of Windows and can also interact with a wide variety of Microsoft programs and servers. You can work with things like Microsoft Office, Exchange Server, and Microsoft SQL Server. Beyond that, you can interact with non-Microsoft databases as well, like MySQL, IBM’s DB2, and more. You can even create your own programs with GUIs. It’s an extremely powerful tool that is also now open source and can be used on Macs and Linux based computers. This is done by using cmdlets, pronounced as “commandlettes”. As the “lettes” part of the word suggests, cmdlets are little commands. In CMD, the commands are self-contained programs, as we showed you that they are executable applications in Windows. Cmdlets are more like building blocks. Each one does a specific thing, but they can be put together to build a full command, or script.

So What’s the Difference Between CMD and PowerShell?

There’s a lot of technical differences between them, and if you’d like you can do more research on it. But what’s important to know is that PowerShell is far less limited than CMD. Think of PowerShell as being what CMD wanted to be when it grew up. If CMD is a multi-tool then PowerShell is the whole garage full of tools. When you start comparing the commands and cmdlets, you’ll also notice that it’s easier to understand what a PowerShell cmdlet might do. Some of the commands are cryptic unless you learn them and use them repeatedly. The purpose of commands like CHKDSK, RMDIR, and TRACERT isn’t as obvious to the average person. But cmdlets follow the naming convention of verb-Noun. The first part tells you what action the cmdlet is going to do, and the second part tells you what thing it is going to do it to. For example, anyone can tell that the cmdlet Get-Help is going to get you help somehow.

Why Would I Use CMD Instead of PowerShell?

That’s a matter of personal choice. In fact, CMD commands can be run from within the PowerShell environment, so there’s a lot of overlap. Sometimes you might just want to do something really simple, like jump into CMD and check the IP address of your computer, or forcefully delete a file. But if that’s something you want to do repeatedly, you’re better off writing a PowerShell script. Remember the rule of automation. If you have to do something more than twice, automate it.

How Do I Access CMD and Powershell?

The easiest way is to click in the search bar on your Start Menu and start typing cmd for the command shell or powershell for PowerShell. Here’s what it looks like for cmd.

For the command shell, you’ll see it listed as Command Prompt app in Windows 10. Earlier versions of Windows will list it as cmd.exe. Opening it will give you a black window with white text in it, like in the image below. See the line C:\Users\Brian> The arrowhead is called the command prompt. You’ll often get instructions for using CMD that say, “Type this at the command prompt…” That’s the spot it’s referring to.

You may notice a couple of choices for PowerShell though. One is simply the Windows PowerShell app and the other is the Windows PowerShell Integrated Scripting Environment (ISE).

If you’re just running a single command or three, then the PowerShell app is good enough. Just to blow your mind, you can use CMD commands in PowerShell, but you can’t use PowerShell in CMD. The PowerShell app looks like this when opened:

Most Common Commands in CMD.exe

Use these commands at the command prompt, press enter to use them. HELP– Will list common commands CD – Displays the name of or changes the current directory. CHDIR – Displays the name of or changes the current directory. CHKDSK – Checks a disk and displays a status report. CLS – Clears the screen. Handy after having run a bunch of commands. COPY – Copies one or more files to another location. DEL – Deletes one or more files. DIR – Displays a list of files and subdirectories in a directory. DISKPART – Displays or configures Disk Partition properties. EXIT – Quits the CMD.EXE program (command interpreter).MKDIR Creates a directory. MORE – Displays output one screen at a time. Useful when a command returns a lot of information and it just keeps scrolling. MOVE – Moves one or more files from one directory to another directory. RENAME – Renames a file or files. RMDIR – Removes a directory. SYSTEMINFO – Displays machine specific properties and configuration. TASKLIST – Displays all currently running tasks including services. TASKKILL – Kill or stop a running process or application.

Most Common Cmdlets in PowerShell

Get-Help – Shows you help for the cmdlet you’re working with. ex: Get-Help Get-Member tells you how to use the Get-Member cmdlet. Get-Member – Shows you what’s inside an item, like a directory or an array. Get-Process – Shows you all the processes running on your computer right now. Get-Service – Shows you all the services on your computer and their current state. Get-Item – Shows you information about a specific thing. ex: Get-Item C:\Users will show you things about the Users directory, like the permissions on it and when it was last modified. Get-ChildItem – Shows you all the things inside of a thing: ex: Get-ChildItem C:\Users will show you all the files and folders immediately inside of the Users directory. That might not seem like a lot, but if you change the verb on those cmdlets you’ve got a whole bunch of cmdlets to work with. Change Get to New on Get-Item and you can create a new item. Now change it to Remove and you can delete items. Change Get-Process to Stop-Process and you can end a specific process. Then change it to Start and you can start a process. You get the idea.

Bonus PowerShell Parameter

-WhatIf may be the most important parameter you’ll ever use. It allows you to run a cmdlet without actually changing anything. It literally makes PowerShell run a ‘What If’ scenario to give you an idea of what’s going to happen when you run the cmdlet for real. If you’re ever concerned you might cause some problems in PowerShell, always add the -WhatIf parameter. Take a look at the list of files in the image below.

Let’s say we want to remove a bunch of files with the cmdlet Remove-Item cc_2017*, but we’re not exactly sure what will happen. Put the -WhatIf parameter on the end, hit enter and we’ll find out!

It tells us that this command would have deleted all these files. If that’s fine, we can remove the -WhatIf from the cmdlet and delete those files. If it isn’t, we can change the cmdlet and test it again.

CMD or PowerShell?

Now that you know more about both, you know it’s not an either/or question. You can use both, there is a good time to use one or the other, and sometimes you can even use them in the same script! Continue to learn more about each and you’ll truly be in complete control of your own computer before long.

Cmd exe versus PowerShell on Windows  A Handy Reference - 53Cmd exe versus PowerShell on Windows  A Handy Reference - 5Cmd exe versus PowerShell on Windows  A Handy Reference - 46Cmd exe versus PowerShell on Windows  A Handy Reference - 3Cmd exe versus PowerShell on Windows  A Handy Reference - 36Cmd exe versus PowerShell on Windows  A Handy Reference - 98Cmd exe versus PowerShell on Windows  A Handy Reference - 47Cmd exe versus PowerShell on Windows  A Handy Reference - 37Cmd exe versus PowerShell on Windows  A Handy Reference - 17