The Academy

Loading the search index…

Searches the academy on this device only.

Command Prompt and PowerShell

Learn the difference between Command Prompt, PowerShell and Windows Terminal, open them on Windows 11, move around folders, list files and create a practice folder, with a table comparing PowerShell and Linux commands.

25 minbeginnerWindowsPractical task needs a laptop or desktop

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

By the end of this lesson you will be able to

  • Explain the difference between Windows Terminal, Command Prompt and PowerShell.
  • Open a terminal on Windows 11 and read its prompt.
  • Move between folders and list their contents in both PowerShell and Command Prompt.
  • Create a practice folder and a file inside it using safe commands.
  • Match common PowerShell commands to their Linux equivalents.

Windows has a command line too, and it is very useful: IT staff use it to check a network, find a file or repair a setting far faster than clicking through menus. If you may use a Windows laptop one day, knowing it will make you feel at home in either system. The ideas are the same as on Ubuntu: a window, a program that reads your commands, and folders to move through. Only the command names differ. In this lesson every command only looks around or works inside a practice folder that you create.

Three names that are easy to mix up

On Ubuntu you learned that the Terminal is the window and the Shell is the program inside it that understands your commands. Windows follows the same split, but has two shells and one window program.

  • Windows Terminal is the modern window. It can hold several tabs, and each tab can run a different shell. On Windows 11 it is normally the default.
  • {{command-prompt|Command Prompt}} (also called cmd) is the older shell. It has existed since the early days of Windows. It is simple, and many old guides use it.
  • {{powershell|PowerShell}} is the newer, more powerful shell. Its commands are called cmdlets and are named Verb-Noun, such as Get-ChildItem. Windows 11 includes the older version called Windows PowerShell 5.1, which is what these lessons use.

Think of Windows Terminal as a phone and the two shells as two different messaging apps that run on it. You can change app without changing phone. Many beginner commands work in both shells, and PowerShell also accepts several old Command Prompt words (dir, cd, copy) as nicknames, called aliases.

Diagram

Windows Terminal is the window; PowerShell and Command Prompt are shells that can run inside it.

Your commands go down, answers come back up

YouType a command, press Enter
Windows TerminalThe window with tabs
PowerShell or Command PromptThe shell that reads the command
Windows 11Does the real work
Windows Terminal is the window; PowerShell and Command Prompt are shells that can run inside it.
Read this figure as text

A stack showing you on top, Windows Terminal below, a choice of PowerShell or Command Prompt, and Windows at the bottom.

Four layers from top to bottom. 1: You, typing commands. 2: Windows Terminal, the window with tabs. 3: The shell running in a tab, which is either PowerShell or Command Prompt. 4: Windows, the operating system that does the work. A new tab can use either shell, and the shell can be changed without changing the window.

Opening a terminal on Windows 11

Open PowerShell in Windows Terminal

  1. Step 1: Right-click the Start button

    Right-click Start (or press the Windows key and X together). In the menu choose Terminal. On some Windows 11 versions this menu item is called Windows PowerShell instead; either is fine.

    You should see: A window opens showing a line that begins with PS and ends with a greater-than sign, for example PS C:\Users\Amina>.

  2. Step 2: Or search for it

    Open Start, type terminal (or powershell) and click the result.

    You should see: The same kind of window opens.

  3. Step 3: Open Command Prompt

    Open Start, type cmd and click Command Prompt. In Windows Terminal you can also click the small arrow beside the plus tab button and choose Command Prompt.

    You should see: A prompt such as C:\Users\Amina> appears, with no PS in front.

  4. Step 4: Close it

    Type exit and press Enter.

    You should see: The tab or window closes. Nothing was changed.

The prompt is the shell's way of saying it is ready. It shows your current folder, the place where commands act unless you say otherwise. The PS in front tells you the shell is PowerShell. Never type the prompt itself.

Diagram

A PowerShell prompt split into its parts.

PSShellPowerShell
SpaceSeparator
C:\Users\AminaCurrent folderWhere commands act
>ReadyType after this
A PowerShell prompt split into its parts.
Read this figure as text

The prompt PS C:\Users\Amina> broken into shell name, current folder and ready sign.

The prompt PS C:\Users\Amina> has three parts. PS means the shell is PowerShell (Command Prompt shows no PS). C:\Users\Amina is the current folder, which is Amina's user folder on drive C. The greater-than sign means the shell is waiting for a command. You type only what comes after it.

Looking around: where am I and what is here?

Windows paths use a backslash (\) between folders and start with a drive letter such as C:. Linux uses a forward slash. In PowerShell, Get-Location shows your current folder and Get-ChildItem lists what is inside it. The shorter nicknames pwd and ls also work in PowerShell, and Command Prompt uses cd with no argument and dir instead. Set-Location Documents (or cd Documents) moves you into a folder inside the current one, and cd .. moves one level up. These commands only read or move you; nothing is changed.

PowerShell (Windows) · you can run this on your own computer
Get-Location
Get-ChildItem
Set-Location Documents
Get-Location
Set-Location ..
Simulated interface: not a real screenshot

A simulated PowerShell window: show the folder, list it, move in and back out.

Windows PowerShell (simulated)
  1. Marker 1: Where am I?
  2. Marker 2: What is here? d at the start of Mode means folder
  3. Marker 3: Moved in: the prompt now shows Documents
A simulated PowerShell window: show the folder, list it, move in and back out.
Read this figure as text

A simulated PowerShell window running Get-Location, Get-ChildItem, Set-Location Documents and back.

A simulated PowerShell window. Get-Location prints a table with a Path column and the value C:\Users\Amina (marker 1). Get-ChildItem prints a table of folders with the columns Mode, LastWriteTime, Length and Name; the folders shown are Desktop, Documents, Downloads and Pictures (marker 2). Set-Location Documents prints nothing, but the prompt changes to PS C:\Users\Amina\Documents> (marker 3). Set-Location .. returns to PS C:\Users\Amina>.

Dates are shown in your computer's local format, so yours may look different. The same actions in Command Prompt are shown below.

Simulated interface: not a real screenshot

A simulated Command Prompt window doing the same job with cd and dir.

Command Prompt (simulated)
  1. Marker 1: cd alone prints the current folder
  2. Marker 2: dir lists; <DIR> marks a folder
  3. Marker 3: cd Documents moves in
A simulated Command Prompt window doing the same job with cd and dir.
Read this figure as text

A simulated Command Prompt showing cd printing the current folder, dir listing folders, cd Documents and cd ..

A simulated Command Prompt. The command cd with nothing after it prints the current folder C:\Users\Amina (marker 1). The command dir prints a listing with a header line Directory of C:\Users\Amina, then lines for the folders Desktop, Documents, Downloads and Pictures, each marked DIR (marker 2). cd Documents moves into that folder and the prompt becomes C:\Users\Amina\Documents> (marker 3).

Making a safe practice folder

From now on, anything that creates or changes files happens inside one folder called practice in your user folder. If you make a mistake, you only affect that folder. In PowerShell, $HOME is a built-in shortcut for your user folder (C:\Users\Amina). New-Item -ItemType Directory -Path $HOME\practice creates the folder; -ItemType Directory says you want a folder and -Path says where. Then Set-Location $HOME\practice moves you in, and New-Item -ItemType File -Name notes.txt creates an empty text file. Test-Path notes.txt answers True if it exists. In Command Prompt the matching commands are mkdir, cd and type nul > notes.txt.

Create the practice folder

Both shells do the same job. Use whichever you opened.

In PowerShell

  1. Step 1: Create the folder

    Type New-Item -ItemType Directory -Path $HOME\practice and press Enter.

    You should see: A small table appears listing a directory named practice with mode d-----.

  2. Step 2: Move into it

    Type Set-Location $HOME\practice.

    You should see: The prompt now ends with \practice>.

  3. Step 3: Create an empty file

    Type New-Item -ItemType File -Name notes.txt.

    You should see: A table lists notes.txt with Length 0.

  4. Step 4: Check it exists

    Type Get-ChildItem.

    You should see: notes.txt is listed.

In Command Prompt

  1. Step 1: Create the folder

    Type mkdir %USERPROFILE%\practice and press Enter.

    You should see: No message. Silence means it worked.

  2. Step 2: Move into it

    Type cd /d %USERPROFILE%\practice.

    You should see: The prompt ends with \practice>.

  3. Step 3: Create an empty file

    Type type nul > notes.txt.

    You should see: No message.

  4. Step 4: Check it exists

    Type dir.

    You should see: notes.txt is listed with size 0.

PowerShell and Linux side by side

If you already know some Ubuntu commands, this table helps. The ideas match; the names and slashes differ. Many PowerShell commands have a Linux-style nickname, but PowerShell's real names are longer so that they describe themselves.

Common tasks in Ubuntu Bash, PowerShell and Command Prompt.
TaskLinux (Bash)PowerShellCommand Prompt
Show current folderpwdGet-Location (alias pwd)cd
List fileslsGet-ChildItem (aliases ls, dir)dir
Change foldercd DocumentsSet-Location Documents (alias cd)cd Documents
Make a foldermkdir practiceNew-Item -ItemType Directory -Name practicemkdir practice
Print textecho helloWrite-Output hello (alias echo)echo hello
Show file contentscat notes.txtGet-Content notes.txt (alias cat)type notes.txt
Clear the screenclearClear-Host (alias cls)cls
Diagram

Command Prompt, PowerShell and Bash compared in three columns.

Command Promptcmd
  • Oldest shell
  • Short commands: dir, cd, type
  • Text output only
  • Backslash paths
  • Not case sensitive
PowerShellWindows 11
  • Newer, more capable
  • Verb-Noun cmdlets
  • Works with structured data
  • Backslash paths
  • Not case sensitive
BashUbuntu
  • Linux shell
  • Short commands: ls, cd, cat
  • Text output
  • Forward-slash paths
  • Case sensitive
Command Prompt, PowerShell and Bash compared in three columns.
Read this figure as text

Three columns comparing Command Prompt, PowerShell and Linux Bash by age, command style and path separator.

Three columns. Command Prompt: the oldest shell, short commands such as dir and cd, text-only output, paths with backslashes. PowerShell: newer, cmdlets named Verb-Noun such as Get-ChildItem, and it can also work with structured data; paths with backslashes, and forward slashes are usually accepted too. Bash on Linux: short lower-case commands such as ls and cd, paths with forward slashes and case-sensitive names.

Common mistakes

  • ✖ Instead of: Typing the prompt, for example PS C:\Users\Amina> Get-Location.

    ✔ Do this: The prompt appears by itself. Type only Get-Location.

  • ✖ Instead of: Using forward slashes or Linux commands exactly as on Ubuntu, such as ls -l.

    ✔ Do this: ls works as a nickname in PowerShell, but the -l option does not exist there. Use Get-ChildItem and the options that PowerShell has.

  • ✖ Instead of: Opening PowerShell 'as administrator' for everyday practice.

    ✔ Do this: Use a normal window. Administrator windows can change the whole system; you do not need them to explore.

If something goes wrong

Cannot find path ... because it does not exist.
The folder name is misspelt or you are in a different folder. Run Get-Location and Get-ChildItem, then retype the path. If you have not yet created practice, create it first.
'foo' is not recognized as an internal or external command in Command Prompt.
Check spelling. If you typed a PowerShell cmdlet such as Get-ChildItem in Command Prompt, switch to PowerShell or use dir.
The Start button menu has no Terminal item.
On some Windows versions it is named Windows PowerShell. You can also search for powershell or cmd in Start.
Text I paste into the window looks wrong or does not run.
Right-click usually pastes in Windows Terminal, and Ctrl+V works in current versions. Paste, read what appeared, and only press Enter if it is exactly what you intended.

Key terms

Command Prompt
The classic Windows program for typing commands.
PowerShell
A powerful Windows text tool where you type commands to control the computer.
Windows Terminal
A Windows app that gives you one window for command tools such as PowerShell and Command Prompt.
Cmdlet
A built-in command in PowerShell, named in a Verb-Noun style.

Practise it for real

Reading is not the same as being able to do it. Complete these on your own computer, then tick only what you have actually done. These ticks are your own honest record: nothing checks them for you.

Guided exerciseNeeds a laptop or desktop

Open a terminal and make your practice folder

On a Windows 11 computer, open Terminal (right-click Start). Run Get-Location, Get-ChildItem, then create $HOME\practice, move into it and create notes.txt. Run Get-ChildItem to confirm. Finish with exit.

You have succeeded when:
Independent challengeNeeds a laptop or desktop

Challenge: do the same job in both shells

Open Command Prompt as well. Without looking at the lesson, list the practice folder in both shells and move up to your user folder in both. Then write down two differences you noticed between the prompts and the outputs.

You have succeeded when:

Knowledge check

6 questions. You need 80% to pass. Mistakes here are part of learning, and you can retry as often as you like.

  1. Question 1.Which statement is correct about Windows Terminal?
  2. Question 2.Match each Linux task to the PowerShell cmdlet.
  3. Question 3.A prompt starting with PS shows that you are in PowerShell.
  4. Question 4.You type Get-Chilitem in PowerShell and get: The term 'Get-Chilitem' is not recognized as the name of a cmdlet, function, script file, or operable program.What does this most likely mean?
  5. Question 5.Put these steps in order to create a practice file safely.
    1. Create the practice folder
    2. Move into the practice folder
    3. Create notes.txt there and list the folder
    4. Open Terminal
  6. Question 6.Why is Remove-Item flagged as dangerous?

Summary

  • Windows Terminal is the window. PowerShell and Command Prompt are the shells inside it.
  • PowerShell prompts start with PS; its commands are Verb-Noun cmdlets with short aliases.
  • Get-Location, Get-ChildItem and Set-Location (or pwd, ls and cd) find your way around, like pwd, ls and cd on Linux.
  • Create a practice folder first and work only there. Deleting from a command line is permanent.

Checklist: can you do these?

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

Related lessons

References and further reading

Official sources for details that can change between versions.

On this page