Becoming a Cap10 of the Windows Command Line 🚀

Objective: Teach absolute beginners how to confidently navigate, manage, and automate file system tasks in Windows using Command Prompt and PowerShell.


Launching Command Prompt & PowerShell

To open Command Prompt (often called cmd.exe): press Win + R, type cmd, and hit Enter. To open PowerShell: press Win + X and select Windows PowerShell (or Windows PowerShell (Admin) for administrative tasks).

$ echo %CD%   # In Command Prompt, shows current directory
PS C:\Users\YourName> pwd   # In PowerShell, shows current location

Think of these shells as your helm for steering through Windows’ file system. You’ll use one or the other interchangeably, depending on your workflow and scripts.

1. Understanding the Windows File System

Before diving into commands, let’s map out how Windows organizes storage:

Key Concepts

  • Drives (C:\, D:\, etc.): Windows assigns a letter to each storage volume—hard drives, SSDs, USB drives, even mapped network shares. The root of each drive is represented by that letter followed by :\.
  • Folders (Directories): Containers inside drives that organize files. Folders can nest to many levels—like folders within folders on your desktop—but accessed via paths.
  • Files: Individual items stored in folders—documents (.txt, .docx), executables (.exe), scripts (.ps1, .bat), images (.png), and more.
  • Paths: A file’s location in Windows is defined by its path, for example C:\Users\YourName\Documents\report.txt. Paths can be absolute (starting at the drive root) or relative (starting from the current folder).
  • Environment Variables: Shorthand tokens that expand to important directories. Examples include %USERPROFILE% (your user folder) and %TEMP% (temporary files folder). Using these makes scripts portable and concise.

Example Structure


C:
├── Program Files
├── Program Files (x86)
├── Windows
├── Users
│   └── YourName
│       ├── Desktop
│       ├── Documents
│       ├── Downloads