CompTIA A+ · Operating Systems
Master every Windows command-line tool from the 220-1202 objective — command name, primary function, and the key flags the exam tests across navigation, network, disk, file management, and OS management categories.
30 min read · Windows Command-Line Tools
// CHECK YOUR KNOWLEDGE
Windows ships with a (cmd.exe) that holds a set of tools every technician must know by name and function. The 220-1202 exam tests these commands directly: given a task, which command? Given a command, what does it do? This lesson covers all of them, organized by category.
Scope: Command Prompt only — PowerShell is out of scope for this lesson. Commands shared with Core 1 (ping, , ipconfig) appear here in the Windows context; the networking concepts behind them are not re-taught.
Open a standard Command Prompt by typing cmd in the Start menu search. For commands that require administrator privileges — specifically sfc — right-click Command Prompt and select Run as administrator.
cd — Change Directory Changes the current working directory.
cd Documents — move into the Documents subfoldercd .. — move up one directory levelcd \ — jump to the root of the current drive (C:\)cd C:\Users\Tech — navigate to a full absolute pathdir — List Directory Lists the contents of the current directory: file and folder names, sizes, and dates.
dir — list files and folders in the current directorydir /a — include hidden and system files in the listingdir /p — pause output after each screen, useful for long listingsReference: addressing, , , and the protocols behind these commands were covered in the Core 1 Networking module. This section teaches Windows command syntax and flags — not the underlying networking concepts.
ipconfig — IP Configuration Displays the IP configuration for all network adapters. The most-tested command in this category.
ipconfig — shows IP address, , and per adapteripconfig /all — full details: address, DHCP enabled/disabled, lease obtained/expires, DHCP server address, DNS server addressesipconfig /release — releases the current DHCP-assigned IP address (sends a DHCPRELEASE message)ipconfig /renew — requests a new DHCP lease from the serveripconfig /flushdns — clears the local DNS resolver cache; forces the next DNS lookup to query the server rather than serving a cached (possibly stale) result▸ EXAM TIP
DHCP troubleshooting sequence with ipconfig: When a machine has an incorrect or stale DHCP lease, the sequence is:
ipconfig /release — drop the current leaseipconfig /renew — request a new oneipconfig /flushdns clears the DNS cache — use it when a hostname resolves to a wrong IP address because the old record is still cached locally.
ping — Test Connectivity Tests reachability of a host by sending Echo Request packets and measuring round-trip time and packet loss. A quick first step for "can this machine reach that host?" Covered in Core 1 ts-network — apply it here as a Windows command.
— Network Statistics Displays active connections and ports the local machine is listening on.
netstat — shows currently active connections onlynetstat -a — shows all connections AND all listening ports (not just active established ones)netstat -n — shows IP addresses and port numbers in numerical form rather than resolving them to hostnames; faster output; useful when DNS is slow or brokennslookup — Name Server Lookup
Queries a DNS server to resolve a hostname to an IP address (or reverse-resolve an IP to a hostname). Use nslookup when you suspect DNS is failing — if ping hostname fails but ping IP-address succeeds, nslookup confirms whether DNS resolution is the problem.
nslookup google.com — shows which DNS server answered and what IP was returnednslookup google.com 8.8.8.8 — queries a specific DNS server (bypasses the configured DNS to test an alternative)net use — Map Network Drive Maps a remote network share to a local drive letter.
net use Z: \\server\share
The mapped drive appears as drive Z: in File Explorer. Run net use alone to list all currently mapped network drives. Use net use Z: /delete to disconnect a mapped drive.
▸ EXAM TIP
net use vs. net user — do not confuse these two:
net use — maps a network drive: net use Z: \\server\sharenet user — manages local user accounts: net user, net user [username]These are among the most commonly confused commands on the exam. The mnemonic: USE = network resources; USER = accounts.
tracert — Trace Route Traces the path packets take from your machine to a destination host, displaying each router hop and the round-trip time to that hop. Used to identify where a connection slows or fails. Covered in Core 1 ts-network — apply it here as a Windows command.
pathping — Path Ping Combines the route-tracing of tracert with packet-loss statistics per hop. Like tracert, pathping shows every hop to the destination. Unlike tracert, it also calculates how many packets are dropped at each hop over a collection period. Use pathping when you need to identify not just but where packets are actually being lost — information tracert cannot provide. Because it collects statistics across many packets per hop, pathping takes significantly longer to complete than tracert.
Reference: chkdsk's diagnostic context was covered in Core 1 ts-storage. This section teaches the Windows command syntax and flags.
chkdsk — Check Disk Checks a volume for filesystem errors and bad sectors.
chkdsk C: — scans drive C: and reports problems (read-only; no changes made)chkdsk C: /f — fixes filesystem errors; repairs corrupted filesystem metadata; requires the volume to be offline (schedules at next reboot if the drive is in use)chkdsk C: /r — locates bad sectors and recovers readable data; includes everything /f does (implies /f); also requires exclusive volume access and schedules at next boot if needed▸ EXAM TIP
chkdsk /f vs. /r — the distinction the exam tests:
/f — fixes filesystem errors (corrupted metadata, journal inconsistencies)/r — locates bad sectors and recovers readable data; implies /f — it also fixes errorsIf the scenario describes physical drive problems (bad sectors, hardware damage), the answer is /r. If it describes only logical filesystem errors, the answer is /f. You cannot run /r without also running /f — /r is the superset.
format — Format a Volume Writes a new filesystem to a volume, making it ready for use. Specifying the filesystem type is standard practice.
format D: /FS:NTFS
format D: /FS:FAT32
format D: /FS:exFAT
▸ WARNING
format destroys all existing data on the target volume. There is no undo. Confirm you have the correct drive letter before running format — running it on the wrong drive letter permanently erases that volume's contents.
diskpart — Disk Partition Manager
An interactive disk partitioning utility. Unlike the other commands in this lesson, diskpart opens its own sub-environment — typing diskpart at the prompt launches a DISKPART> prompt with its own command set. Common operations inside diskpart: list disk, select disk, create partition primary, format fs=ntfs quick, assign letter=D.
Know what diskpart does (interactive command-line disk partitioning and management) and that it is the command-line counterpart to the Disk Management (diskmgmt.msc from L4). You do not need to memorize the full diskpart command set for the A+ exam.
md (or mkdir) — Make Directory Creates a new directory at the current path or a specified full path.
md Backups
md C:\Users\Tech\ProjectFiles
Both md and mkdir are accepted — they are identical commands.
rmdir (or rd) — Remove Directory Removes a directory. By default, the directory must be empty.
rmdir FolderName — removes an empty directory onlyrmdir FolderName /s — removes the directory and all of its contents — every file and subfolder inside it; Windows prompts for confirmation before proceeding▸ WARNING
rmdir /s deletes a directory and everything inside it — all nested files and subfolders. There is no Recycle Bin for command-line deletions — the operation is immediate and permanent. Confirm the exact path before running.
robocopy — Robust File Copy
An advanced file copy tool that preserves metadata the basic copy command discards. Robocopy maintains:
Robocopy is the standard tool for migrating user data or performing backups where permissions must be maintained. The basic copy command copies file data only — ACLs and timestamps are not transferred.
▸ EXAM TIP
robocopy = "Robust File Copy" — both the abbreviation and the full name expansion are exam-relevant. Key properties: preserves NTFS permissions, timestamps, and file attributes; handles interrupted copies by resuming rather than restarting. The basic copy command does not preserve permissions. Use robocopy whenever a migration must keep ACLs intact.
hostname Displays the computer's network hostname — the name the machine uses to identify itself on the network. No arguments needed.
net user — Manage Local User Accounts
Manages local user accounts on this machine. Note: net use maps network drives; net user manages accounts — review the callout above if needed.
net user — lists all local user accountsnet user [username] — displays account details: full name, last logon time, group membership, password policynet user [username] [password] — sets or changes the account passwordnet user [username] /add — creates a new local user accountnet user manages local accounts only. Domain accounts are managed on the — not via net user on the local machine.
winver — Windows Version Opens a dialog box showing the Windows version, build number, and edition. A quick way to identify what version of Windows is installed without navigating to Settings → System → About.
whoami — Current User Displays the currently logged-in username.
DOMAIN\usernameCOMPUTERNAME\usernameUseful for confirming which account context is active — especially after running as administrator or switching accounts.
[command] /? — Built-in Help
Appending /? to any Windows Command Prompt command displays its built-in syntax reference: available flags, usage examples, and brief descriptions.
chkdsk /?
netstat /?
robocopy /?
ipconfig /?
▸ EXAM TIP
[command] /? is the universal help flag for Windows Command Prompt. It works on virtually every command in this lesson. When you need a flag's exact syntax at the bench — no internet required.
gpupdate — Update Forces Group Policy to refresh immediately on the local machine. Group Policy normally refreshes automatically on a background schedule (every 90 minutes for users, with a random offset). Use gpupdate after a policy change to apply it without waiting for the next automatic cycle.
gpupdate — refreshes only policy settings that have changed since the last refreshgpupdate /force — re-applies all Group Policy settings regardless of whether they have changed; use when a policy should be applied but is not taking effectgpresult — Group Policy Result Shows which Group Policy settings are currently applied to the computer and the logged-in user — the Resultant Set of Policy (RSoP). Use it to confirm that a policy change applied correctly after running gpupdate.
gpresult /r — displays a summary of applied policies directly in the command prompt windowgpresult /h report.html — generates a full HTML report of all applied policy settingssfc — System File Checker Scans all protected Windows system files for corruption and replaces any damaged or missing files using a cached backup copy stored locally. Use sfc when Windows is behaving unexpectedly and you suspect core system files are corrupted.
sfc /scannow — begins an immediate scan and repair▸ EXAM TIP
sfc /scannow requires an elevated (administrator) Command Prompt. Running it from a standard user prompt returns an access-denied error. Always right-click Command Prompt → "Run as administrator" before running sfc. The scan takes several minutes — do not close the window while it runs.
▸ EXAM TIP
All commands — name, function, and key flags:
| Command | Primary Function | Key Flags / Syntax |
|---------|-----------------|-------------------|
| cd | Change directory | cd .. (up one), cd \ (root) |
| dir | List directory contents | /a (include hidden), /p (page) |
| ipconfig | Show IP configuration | /all, /release, /renew, /flushdns |
| ping | Test host reachability | — |
| netstat | Show connections and listening ports | -a (all ports), -n (numeric) |
| nslookup | Query DNS to resolve hostname | hostname or IP |
| net use | Map network drive | net use Z: \\server\share |
| tracert | Trace route to host | — |
| pathping | Trace route + packet loss per hop | — |
| chkdsk | Check volume for errors/bad sectors | /f (fix errors), /r (bad sectors; implies /f) |
| format | Format volume with filesystem | /FS:NTFS, /FS:FAT32, /FS:exFAT |
| diskpart | Interactive disk partition tool | Launches sub-environment |
| md / mkdir | Create directory | — |
| rmdir / rd | Remove directory | /s (remove directory + all contents) |
| robocopy | Robust File Copy — preserves permissions/timestamps/attributes | — |
| hostname | Display computer's network name | — |
| net user | Manage local user accounts | (none) = list; [username] = details; /add = create |
| winver | Show Windows version/build/edition | — |
| whoami | Show current logged-in username | — |
| [cmd] /? | Display command help and syntax | Works on any Command Prompt command |
| gpupdate | Force Group Policy refresh | /force (re-apply all policies) |
| gpresult | Show applied Group Policy (RSoP) | /r (summary), /h file.html (full report) |
| sfc | Scan and repair protected system files | /scannow (requires elevated prompt) |
Sandboxed terminal challenges. Type the right command for each task — no real shell, no real filesystem, just realistic simulated output.
The check questions below test your ability to match commands to tasks, select the correct flag for a scenario, and distinguish the commonly confused net use from net user.
Sign in to check your knowledge and earn XP. Sign in