PowerShell vs CMD, explained for beginners: what each Windows shell is, how to tell which one you are in, why pasted commands fail, and which one to learn first.
The short answer
Learn PowerShell. It ships with Windows, so there is nothing to install. It understands the everyday names that CMD users know, such as dir, cd, copy and del, and it adds its own, more capable commands on top. Microsoft itself recommends PowerShell over the older Windows commands for automating Windows.
Then know that CMD exists. Older guides and some install pages are written for it, and pasting one shell’s command into the other is an easy way to get stuck on day one. Below: what each shell is, why there are two kinds of PowerShell, how to tell which one you are in, and a pretend terminal to try the commands safely.
The older shell: Command Prompt (CMD)
A shell is the program that reads your command and gets the computer to carry it out. Microsoft’s command reference says Windows has two of them: the Command shell and PowerShell. The Command shell is better known as CMD or Command Prompt, and its program file is cmd.exe. Microsoft describes it as the first shell built into Windows for automating routine jobs, using batch files: small scripts whose names end in .bat.
CMD is still part of Windows, and it still does the basics well: listing folders, copying files, running programs. What it cannot do is run PowerShell’s own commands. It also has its own way of writing options, with a forward slash. For example, del /p notes.txt asks for a yes or no before deleting each file.
The newer shell, in two editions
Microsoft says PowerShell can run Windows commands too, plus its own commands, called cmdlets. Cmdlets have long, readable names such as Get-ChildItem, Copy-Item and Remove-Item: a verb, a dash, then the thing it works on. For everyday jobs PowerShell also answers to short nicknames, called aliases, so dir, cd, copy and del work much as they do in CMD.
Here is the part many comparison pages skip. Microsoft makes two products with almost the same name, and they are not the same thing:
- Windows PowerShell 5.1 ships inside Windows. It is the latest version of Windows PowerShell. Microsoft is no longer adding new features to it, and its support follows your version of Windows. Its program is powershell.exe, and it runs only on Windows.
- PowerShell 7, called plain "PowerShell" in Microsoft’s own naming, is a separate, open-source download built on newer versions of .NET. It runs on Windows, macOS and Linux, its program is called pwsh, and it installs side by side with Windows PowerShell, so you can have both.
So "PowerShell is cross-platform" is true of PowerShell 7 (and version 6 before it), not of the copy built into Windows. Even in PowerShell 7, some nicknames exist only on Windows: on a Mac or Linux, ls runs the system’s own ls rather than PowerShell’s. For a beginner on Windows, the built-in Windows PowerShell is plenty. The commands DayOneCode teaches work in both editions, with one difference to know: in Windows PowerShell 5.1, > saves text as UTF-16, which some tools (Git reading a .gitignore, for one) cannot read, while PowerShell 7 saves UTF-8. You can add PowerShell 7 later if you want it.
The window is not the shell
A third name adds to the muddle: Windows Terminal. Microsoft describes it as a modern host application for command-line shells such as Command Prompt, PowerShell and bash. It is the window, with tabs, panes, colours and themes. The shell is the program running inside each tab or pane.
DayOneCode says that using a terminal is like talking to the waiter instead of pointing at the menu. In that picture, CMD and PowerShell are two waiters who speak slightly different dialects, and Windows Terminal is the dining room they work in. It can hold many tables, but it never takes an order itself. One tab can run Windows PowerShell while the next runs Command Prompt, so "I opened Terminal" does not tell you which shell you are talking to. If the whole idea of a terminal is new, start with What is a terminal?.
Same jobs in both shells
For everyday file work the two dialects are close. Microsoft says the nicknames are there so that people used to CMD, or to Unix shells like the ones on Mac and Linux, can keep using names they already know.
| Job | CMD | PowerShell short name | PowerShell full name |
|---|---|---|---|
| List a folder | dir | dir or ls | Get-ChildItem |
| Go into a folder | cd Documents | cd Documents | Set-Location |
| Make a folder | mkdir games | mkdir games | New-Item -ItemType Directory |
| Show a text file | type notes.txt | type or cat | Get-Content |
| Copy a file | copy a.txt b.txt | copy or cp | Copy-Item |
| Move a file | move a.txt backups | move or mv | Move-Item |
| Rename a file | ren a.txt b.txt | ren | Rename-Item |
| Delete a file | del a.txt | del or rm | Remove-Item |
| Check before deleting | del /p a.txt (asks yes or no) | rm a.txt -WhatIf (only shows) | Remove-Item -WhatIf |
| Clear the screen | cls | cls or clear | Clear-Host |
The nicknames are only skin-deep. del in PowerShell is really Remove-Item, so CMD’s slash options such as /p do not work with it. PowerShell’s options start with a dash instead. The most useful one for a beginner is -WhatIf: it shows what a command would do, and then does nothing at all.
A pretend PowerShell on a pretend disk: nothing here touches your real files. Use the CMD-style names, then ask Get-Alias what they really run.
Get-Alias is the quickest way to learn the real names. Ask it about a nickname such as dir or cp and it answers with the cmdlet behind it, such as dir -> Get-ChildItem.
Which shell am I in?
Two quick checks answer it. The first tells PowerShell from CMD; the second tells the two editions of PowerShell apart.
- Look at the prompt, the text just before the blinking line. PowerShell starts it with PS, as in
PS C:\Users\you>. CMD shows only the folder, as inC:\Users\you>. - In PowerShell, run
$PSVersionTable. It answers with a small table. A PSVersion that starts with 5.1 and a PSEdition of Desktop mean Windows PowerShell, the one built into Windows. A PSVersion that starts with 7 and a PSEdition of Core mean PowerShell 7. If you are in CMD by mistake, it simply says the command is not recognised.
PS C:\Users\you> $PSVersionTable.PSEdition
DesktopThe practice terminal on this page always shows PS, because it pretends to be Windows PowerShell, the shell DayOneCode teaches. It does not know $PSVersionTable, so try that one on your own computer.
Why a pasted command fails
Some install pages for coding tools give a separate line for each shell, and pasting the wrong one is the classic first-day error. The install page for Claude Code, an AI coding tool, is a good example: it gives a PowerShell line that starts with irm, a different CMD line that joins its steps with &&, and the two error messages you see if you mix them up. Red text is a clue, not a disaster:
The token '&&' is not a valid statement separatormeans a CMD line landed in Windows PowerShell 5.1. The&&sign, which runs the next step only if the last one worked, arrived in PowerShell 7, so 5.1 rejects it. Open Command Prompt and paste the line there, where it was written to run.'irm' is not recognized as an internal or external commandmeans a PowerShell line landed in CMD. CMD cannot run PowerShell commands, so open PowerShell and paste it again.- The same "not recognized" message appears if you try
lsorpwdin CMD. Those are PowerShell (and Mac and Linux) names, not CMD ones; in CMD,dirlists a folder.
When you write your own two-step line in Windows PowerShell 5.1, Microsoft documents the long way round for &&: a semicolon, then a check of $?, which holds True when the last command worked.
git add .; if ($?) { git commit -m "First save" }Which one should a beginner learn?
PowerShell, for four reasons:
- It is already there. Windows PowerShell ships with Windows, so there is nothing to download and no account to make.
- It covers CMD’s everyday jobs. The nicknames mean
dir,cd,copyanddelstill work, and Microsoft says it runs Windows commands as well as its own. - It goes further. Cmdlets,
-WhatIfandGet-Aliasexist only in PowerShell, and Microsoft recommends it for automating Windows. - AI coding agents can use it. Claude Code’s docs say that on Windows without Git for Windows installed, it uses PowerShell to run its commands. Read What is an AI coding agent? before you set one up.
Keep CMD in your back pocket. When a guide says "open Command Prompt", or a line full of && fails in Windows PowerShell 5.1, open CMD for that one job and come back. You do not need its slash options until a guide asks for them.
That is the path DayOneCode follows, with no account and no install. Meet the terminal starts you in a practice PowerShell, and Dialects: PowerShell, CMD, Mac matches the names across all three. Then race the names in Command Racer, keep the PowerShell cheat sheet beside your real terminal, and read PowerShell for beginners next.
Try it on DayOneCode
- Dialects: PowerShell, CMD, Mac
Lesson 19 of the free course: ls or dir, cp or copy, and how to ask PowerShell what a nickname really runs.
- Meet the terminal
Lesson 5: your first dir and cd in a practice PowerShell that cannot touch your real files.
- Delete carefully
Lesson 17: look with dir, then delete with rm, on a pretend disk where a slip costs nothing.
- PowerShell cheat sheet
Every terminal command the course teaches, on one page, with what it does and an example.
Questions and answers
Should I learn CMD or PowerShell first?
Learn PowerShell first. It ships with Windows, it accepts the everyday CMD names such as dir, cd, copy and del, and it adds its own commands that CMD cannot run. Microsoft recommends PowerShell for automating Windows. Learn just enough about CMD to recognise it, so you can open Command Prompt when an older guide asks for it.
Can PowerShell do everything CMD can?
For everyday work, yes. Microsoft says PowerShell can run Windows commands as well as its own cmdlets, while CMD can run only Windows commands. The catch is in the details: in PowerShell, dir and del are nicknames for cmdlets, so CMD options that start with a slash, such as del /p, do not work, and Windows PowerShell 5.1 rejects &&. A line written for CMD is safest in a CMD window.
How do I know if I am in CMD or PowerShell?
Look at the prompt. PowerShell puts PS in front of the folder, as in PS C:\Users\you>, while CMD shows only the folder, as in C:\Users\you>. To see which PowerShell you have, run $PSVersionTable. Version 5.1 with the edition Desktop is the Windows PowerShell built into Windows; version 7 with the edition Core is PowerShell 7.
What is the difference between Windows PowerShell and PowerShell 7?
They are two separate products. Windows PowerShell 5.1 ships with Windows, runs only on Windows and gets no new features. PowerShell 7 is a separate, open-source download built on newer .NET. It runs on Windows, macOS and Linux, its program is called pwsh, and it installs side by side with Windows PowerShell. A beginner can start with either.
Is Windows Terminal the same as PowerShell or CMD?
No. Windows Terminal is the window, not the shell. Microsoft calls it a host application for shells such as Command Prompt, PowerShell and bash. Each tab or pane runs its own shell, so one tab can be Windows PowerShell while the next is Command Prompt. Check the prompt to see which shell a tab is running.
Why does && not work in PowerShell?
The && operator, which runs the next command only if the last one worked, arrived in PowerShell 7. Windows PowerShell 5.1, the version built into Windows, stops with an error saying the token && is not a valid statement separator. A line written for CMD belongs in Command Prompt, so open it and paste the line there. For your own commands, run the steps one at a time or use PowerShell 7.
Sources
The facts on this page were checked against these pages (14 November 2026):
- Microsoft Learn: Windows commands (the two command-line shells)
- Microsoft Learn: What is Windows PowerShell?
- Microsoft Learn: Differences between Windows PowerShell 5.1 and PowerShell 7.x
- Microsoft Learn: An overview on Windows Terminal
- Microsoft Learn: Using aliases (compatibility aliases in Windows)
- Microsoft Learn: about_Pipeline_Chain_Operators (&& and ||)
- Microsoft Learn: about_Automatic_Variables ($PSVersionTable)
- Microsoft Learn: Remove-Item (-WhatIf)
- Microsoft Learn: del (Windows commands)
- Claude Code docs: Overview (install commands for PowerShell and CMD)
More from the blog
- What is a terminal? The plain answer, and your first three commands
A terminal is the window where you give your computer commands in words. Learn terminal vs shell vs command line, how to open one, and try three safe commands.
- What is a file path? Every file’s home address, explained
A file path is the address of a file on your computer. See Windows and Mac paths side by side, absolute vs relative paths, how to copy a path, and try it safely.
- What is an AI coding agent? What it does, and how to stay the boss
An AI coding agent reads your project, edits files and runs commands. See how it differs from a chatbot, how to stay safe, and who is old enough to use one.