The Command Line Starter Kit

The Command Line Starter Kit

A plain-language guide to PowerShell and Command Prompt for people who have never opened either, plus a generator that writes the command for you and explains every piece of it. Every command on this page only reads your files. Nothing here deletes, moves, or changes anything.

Why I started using the command line

Back to top

The first time I opened PowerShell on purpose was because someone asked me for a complete list of every file on a shared drive, with sizes and dates. Clicking through folder after folder in File Explorer and typing names into a spreadsheet would have taken the afternoon and still missed things. One line in PowerShell did it in a few seconds and wrote the result straight to a CSV I could open in Excel.

Since then I reach for it whenever File Explorer runs out: counting files before a data transfer, finding every PDF buried in a project folder, checking which files changed after a certain date, or documenting what a mapped drive holds before a migration. None of that requires programming. It requires knowing one or two commands and not being afraid of the black window.

That fear is the part this page is for. The window looks like it belongs to an IT department, but reading files is the safest thing you can do with it. This guide explains what the two Windows tools are, how to open them, how to read a command so you know what it will do before you press Enter, and it writes the command for you.

PowerShell and Command Prompt are two different tools

Back to top

Both are programs that take typed instructions instead of clicks. They come with every copy of Windows, and they can both list, count, and search files. The difference is age and what each one can do for you.

Command Prompt
C:\Users\danielle> dir "M:\Projects" /s /b
M:\Projects\2025 Grant\budget.xlsx
M:\Projects\2025 Grant\narrative.docx
M:\Projects\Registry\protocol_v3.pdf
C:\Users\danielle>

Command Prompt: the black window. Commands are short, and the output is plain text.

Command Prompt (cmd.exe)

  • The older tool, descended from MS-DOS in the 1980s.
  • Commands are short words like dir, cd, tree, find.
  • Everything it gives back is text on the screen. To keep it, you send that text to a file.
  • Good for quick listings and for following instructions written twenty years ago that still work.
Windows PowerShell
PS C:\Users\danielle> Get-ChildItem -Path "M:\Projects" -Recurse -File
    Directory: M:\Projects\2025 Grant

Mode      LastWriteTime      Length Name
----      -------------      ------ ----
-a---   3/14/2026 9:12 AM    48211 budget.xlsx
-a---   3/16/2026 4:40 PM   210544 narrative.docx
PS C:\Users\danielle>

PowerShell: the blue window. Commands are Verb-Noun pairs, and the output comes back as columns you can sort, filter, and export.

PowerShell

  • The newer tool, built by Microsoft in the 2000s and still actively developed.
  • Commands are readable pairs like Get-ChildItem (get the items in a folder) and Export-Csv (write them to a CSV).
  • It produces structured records, not just text, so a file listing already knows each file's size and date and can go straight into a spreadsheet.
  • Good for anything you would otherwise do by hand in Excel: filtering by size, date, or type, and saving a clean CSV.

Which one should you use?

PowerShell, unless someone hands you instructions written for Command Prompt. It does everything Command Prompt does, its commands read like English once you know the pattern, and its CSV export is the single most useful thing on this page. Most Command Prompt commands also run inside PowerShell, so you rarely lose anything by choosing it.

You want toCommand PromptPowerShell
See what is in a folderdirGet-ChildItem (or dir, which works there too)
Move to a different foldercdcd or Set-Location
Save a listing to a file> list.txt (plain text only)Export-Csv (a real spreadsheet file)
Keep only files over a certain sizeAwkward (forfiles)Where-Object { $_.Length -gt 100MB }
Clear the screenclscls or Clear-Host
Close the windowexitexit
Windows Terminal, "PowerShell 7", and the Mac Terminal: names you may also run into

Windows Terminal is a window that can hold either tool in tabs, the way a browser holds web pages. On Windows 11 it opens by default. If you open it and see a blue prompt starting with PS, you are in PowerShell; a black prompt ending in > with no PS is Command Prompt.

Windows PowerShell 5.1 is the version built into Windows. PowerShell 7 is a newer, separately installed version. Everything in this guide works in both.

Terminal on a Mac (and on Linux) is a different family entirely. The ideas are the same but the words are different: ls instead of dir, forward slashes instead of backslashes. The generator below is for Windows.

Opening a window

Back to top

PowerShell

  1. Press the Windows key, or click Start.
  2. Type powershell. You do not need to click in a search box first; typing after pressing the key is enough.
  3. Press Enter when "Windows PowerShell" is highlighted.
  4. A blue window opens. The line ending in > is the prompt: it shows the folder you are standing in and waits for you to type.

Command Prompt

  1. Press the Windows key.
  2. Type cmd.
  3. Press Enter when "Command Prompt" is highlighted.
  4. A black window opens with the same kind of prompt.
Do not choose "Run as administrator" unless an instruction specifically tells you to. For reading files you never need it, and an administrator window often cannot see your mapped drives (the M: or S: letters set up by your IT department), which is confusing when the drive is plainly there in File Explorer.

A shortcut from File Explorer

Open the folder you care about in File Explorer, click once in the address bar at the top, type powershell in place of the path, and press Enter. PowerShell opens already standing in that folder, so you can leave the -Path part out of most commands. Typing cmd there does the same for Command Prompt.

How to read a command before you run it

Back to top

A command is a sentence with a fixed word order. Once you can pick out the parts, you can tell what any command will do, and whether it is safe, before pressing Enter.

Windows PowerShell
PS C:\> Get-ChildItem -Path "M:\Projects" -Recurse -File | Export-Csv -Path "C:\Temp\files.csv" -NoTypeInformation
  • Get-ChildItemThe verb and noun. "Get" reads; it never changes anything. Verbs that change things are "Remove", "Move", "Rename", "Set", and "Clear". If you see one of those and did not expect it, stop.
  • -Path "M:\Projects"Where to look. Anything starting with a hyphen is an option, and the text after it is the value for that option. Paths with spaces need quotation marks.
  • -RecurseInclude every subfolder, all the way down. Leave it off to look at one folder only.
  • -FileFiles only; leave folders out of the list. -Directory does the opposite.
  • |The pipe (on the key above Enter, with Shift). It sends the result of the left side into the command on the right side. Read it as "and then".
  • Export-Csv -Path "..."Write the list to a CSV file at that location. This creates a new file; it does not touch the files that were listed. -NoTypeInformation keeps a technical header line out of the file so Excel opens it cleanly.

Command Prompt uses the same shape with different spelling: dir "M:\Projects" /s /b is the command, the path, and two options marked with slashes instead of hyphens (/s for subfolders, /b for "bare", meaning paths only with no extra text).

What "safe" means here. A command that starts with Get, dir, tree, Measure, Select, Where, or find only reads. The only thing on this page that writes anything is the export step, and it writes a new file to a location you choose.

Command generator

Back to top

Choose what you want to know, paste in the folder, and copy the command. Both versions are shown, with a note on which one to prefer for that task and an explanation of each part.

Copy it from the File Explorer address bar. A mapped drive looks like M:\; a network path looks like \\server\share\folder. Both work.

When it does not work

Back to top
"Cannot find path" or "The system cannot find the path specified"
  • The path has a space in it and is not in quotation marks. M:\2025 Grant fails; "M:\2025 Grant" works.
  • You are in an administrator window and the mapped drive letter is not visible there. Close it and open a normal window, or use the full network path (\\server\share\...) instead of the letter. To find that path, right-click the drive in File Explorer and choose Properties.
  • A typo. Paste the path from File Explorer rather than typing it.
"Access is denied" on some folders

You can see the folder but do not have permission to read inside it. PowerShell will print a red error for that folder and keep going with the rest. The listing is still complete for everything you are allowed to see. Add -ErrorAction SilentlyContinue after -File to hide those messages.

Red text about "execution policy" or "scripts is disabled on this system"

That message is about running saved script files (.ps1). Commands typed directly into the window are not affected by it. If you see it, you most likely pasted a command that had a line break in it; paste it again as a single line.

The listing scrolls past faster than you can read

That is normal on a big drive. Use the CSV option in the generator instead and open the result in Excel, or add | more to the end of the command to see one screen at a time (press the space bar for the next screen, Q to stop).

Nothing happens, or the window seems stuck

A listing of a large network drive can take several minutes, and the window shows nothing until it has finished. Wait for the prompt to come back. If you want to stop early, press Ctrl + C. That cancels the command and harms nothing.

I pressed the up arrow and an old command appeared

The up and down arrows walk through the commands you already ran, which is a convenience once you expect it. Press Esc to clear the line.

Printable cheat sheet

Back to top
TaskPowerShellCommand Prompt
Where am I?Get-Locationcd (on its own)
Go to a foldercd "M:\Projects"cd /d "M:\Projects"
List this folderGet-ChildItemdir
List everything below itGet-ChildItem -Recurse -Filedir /s /b
Count files below it(Get-ChildItem -Recurse -File).Countdir /s /b /a-d | find /c ":\"
Only PDFsGet-ChildItem -Recurse -Filter *.pdfdir *.pdf /s /b
Save to a spreadsheet... | Export-Csv "C:\Temp\files.csv" -NoTypeInformation... > "C:\Temp\files.txt"
Folder treetree /Ftree /F
Stop a running commandCtrl + CCtrl + C
Clear the screenclscls
Close the windowexitexit

Sources and further reading

The Command Line Starter Kit is a free tool from Boyce Data Science. Commands were checked against Windows PowerShell 5.1 and Command Prompt on Windows 11 in September 2026.