Skip to cheat sheet
← Return to Arsenal
CHEAT SHEET / WIN

ARSENAL / COMMAND CHEAT SHEETS

Windows Command Line

Every command on the A+ Core 2 list, grouped by the job you are trying to do.

This sheet follows CompTIA A+ 220-1202 objective 1.5, "use the appropriate Microsoft command-line tools." Each card says what the command does, when to reach for it, and the switches worth knowing. A few extra commands you will meet on the job are marked as not on the current list.

00 / BEFORE YOU TYPE

Opening the right prompt

NeedHow
Standard promptStart, type cmd, press Enter. Or open Windows Terminal.
Elevated (administrator) promptStart, type cmd, then Ctrl+Shift+Enter, or right-click and choose Run as administrator. The title bar says Administrator.
Help for any command[command name] /?, for example robocopy /?
Stop a running commandCtrl+C (for example, a continuous ping -t).

Cards tagged admin need an elevated prompt for all or part of their job. Cards tagged destructive can erase data. Switches are not case-sensitive, and most also accept a hyphen instead of a slash.

02 / FILE MANAGEMENT

Creating, removing, and copying

md1.5

Make directory (same as mkdir). It creates any missing parent folders in the path too.

When to use it: building a folder structure from a script or the prompt.

md C:\Scripts\Logs\2026

rmdir1.5destructive

Remove directory (same as rd). Without switches it only removes an empty folder. /s removes the folder and everything inside; /q skips the confirmation. Deleted items do not go to the Recycle Bin.

When to use it: cleaning up an old folder tree you are sure you no longer need.

rmdir C:\Temp\Empty
rmdir /s /q C:\Temp\OldProject

robocopy1.5

Robust File Copy. Copies folder trees, keeps going after network drops, retries failed files, and logs what it did. /e copies subfolders including empty ones, /z is restartable mode, /mir mirrors the source, /r: and /w: set retries and wait time, /log: writes a log.

When to use it: migrating a user's data to a new PC or copying large folders to a server.

robocopy C:\Users\jsmith\Documents \\FS01\Backups\jsmith /e /z /r:2 /w:5 /log:C:\robocopy.log

Careful with /mir: it also deletes files in the destination that are not in the source.

03 / NETWORK

Troubleshooting connectivity

A good order for a "no internet" ticket: ipconfig (do I have a valid address?), ping the gateway, ping an outside IP, then nslookup a name. That splits addressing, routing, and DNS problems apart.

ipconfig1.5

Shows IP address, subnet mask, and default gateway per adapter. /all adds the MAC (physical) address, DHCP server, lease times, and DNS servers. /release and /renew drop and request a DHCP lease. /flushdns clears the DNS resolver cache; /displaydns shows it.

When to use it: the first check on any network problem. A 169.254.x.x address (APIPA) means the PC did not get a DHCP lease.

ipconfig /all
ipconfig /release
ipconfig /renew
ipconfig /flushdns

ping1.5

Sends ICMP echo requests and reports replies and round-trip time. Windows sends 4 by default. -t pings until you press Ctrl+C, -n sets the count, -a resolves an IP to a hostname, -l sets the packet size.

When to use it: "Can I reach it at all?" Ping 127.0.0.1 to test the local TCP/IP stack, then the gateway, then beyond. Some hosts and firewalls block ICMP, so no reply is not always a dead host.

ping 192.168.1.1
ping -n 10 8.8.8.8
ping -t fileserver01

tracert1.5

Lists every router hop between you and a destination, with three timing samples per hop. -d skips name lookups so it runs faster.

When to use it: ping fails or is slow and you need to see where along the path it stops or slows down. Asterisks (*) mean a hop did not answer in time.

tracert www.comptia.org
tracert -d 8.8.8.8

pathping1.5

Combines tracert and ping. It maps the route, then sends many pings to every hop and reports the packet loss percentage at each one. Expect it to take several minutes.

When to use it: a connection works but drops packets intermittently and you need to find which hop is losing them.

pathping www.comptia.org

netstat1.5admin for -b

Shows active TCP connections and listening ports. -a all connections and listeners, -n numbers instead of names (faster), -o the owning process ID, -b the program name, -r the routing table.

When to use it: finding what is listening on a port, or spotting an unexpected outbound connection from possible malware.

netstat -ano
netstat -b

nslookup1.5

Queries DNS directly. Give it a name to get the IP address back, or add a server to ask a specific resolver. -type=mx (or other record types) looks up mail servers and other records.

When to use it: a site works by IP address but not by name, which points at DNS.

nslookup www.comptia.org
nslookup www.comptia.org 1.1.1.1
nslookup -type=mx comptia.org

net use1.5

Maps, lists, and removes network drive letters. /persistent:yes reconnects the drive at every sign-in; /delete removes a mapping. On its own it lists current mappings.

When to use it: mapping a share from a script, or fixing a drive letter that points at the wrong place.

net use
net use S: \\FS01\Sales /persistent:yes
net use S: /delete

04 / DISK MANAGEMENT

Checking and preparing drives

chkdsk1.5admin

Checks a volume's file system for errors. Without switches it only reports. /f fixes file system errors; /r also finds bad sectors and recovers readable data (it includes /f). The volume must be locked, so on the system drive it offers to run at the next restart.

When to use it: files are corrupt, a drive was unplugged mid-write, or Windows reports a disk error.

chkdsk C:
chkdsk D: /f
chkdsk C: /r

format1.5admindestructive

Creates a new file system on a volume and erases what was there. /fs: chooses NTFS, exFAT, or FAT32; /q is a quick format (skips the bad-sector scan); /v: sets the volume label.

When to use it: preparing a USB drive or a new partition. Double-check the drive letter first.

format E: /fs:exFAT /q /v:USBDRIVE

diskpart1.5admindestructive

An interactive partitioning tool with its own DISKPART> prompt. You select a disk, partition, or volume, then act on it. clean wipes the partition table on the selected disk.

When to use it: partitioning from the command line, from Windows recovery or setup, or when Disk Management cannot fix a drive.

diskpart
list disk
select disk 1
clean
create partition primary
format fs=ntfs quick label=Data
assign letter=F
exit

Always run list disk and check sizes before select disk. clean on the wrong disk erases it.

05 / INFORMATIONAL

Who, what, and which version

hostname1.5

Prints the computer's name. Nothing else, no switches.

When to use it: a user on the phone needs to tell you which PC they are on.

hostname

net user1.5admin to change

Lists local user accounts, shows details for one (last logon, password expiry, group memberships), or adds, changes, and removes accounts. /domain queries the domain instead. Use * to be prompted for a password so it never appears on screen.

When to use it: checking whether an account is active or locked, or resetting a local password.

net user
net user jsmith
net user jsmith *
net user tempuser * /add

winver1.5

Opens the About Windows dialog with the edition, version (such as 24H2), and OS build number.

When to use it: checking whether a PC has a feature update before installing software or troubleshooting.

winver

whoami1.5

Shows the signed-in account as domain\user or computer\user. /groups lists group memberships; /priv lists privileges.

When to use it: confirming which account a prompt or script is running as, especially after a Run as.

whoami
whoami /groups

[command name] /?1.5

Prints the built-in help for a command: syntax, every switch, and examples. help on its own lists many built-in commands.

When to use it: any time you forget a switch. It works offline.

ipconfig /?
robocopy /?

06 / OS MANAGEMENT

Group Policy and system files

gpupdate1.5

Applies Group Policy changes now instead of waiting for the next background refresh (about every 90 minutes). /force reapplies every policy, not just changed ones. Some settings still need a sign-out or restart.

When to use it: an admin just changed a policy and the user needs it right away.

gpupdate
gpupdate /force

gpresult1.5

Shows the Resultant Set of Policy: which Group Policy Objects actually applied to this user and computer, and which were filtered out. /r is a summary; /h saves an HTML report.

When to use it: a policy "is not working" and you need to prove whether it applied at all.

gpresult /r
gpresult /h C:\Temp\gp-report.html

sfc1.5admin

System File Checker. /scannow scans protected Windows system files and replaces corrupted ones from a cached copy. /verifyonly checks without repairing.

When to use it: crashes, errors, or odd behavior after malware cleanup or a failed update. If sfc cannot repair files, run DISM /Online /Cleanup-Image /RestoreHealth and then sfc again.

sfc /scannow

07 / ALSO HANDY

Useful, but not on the 220-1202 list

These are not named in objective 1.5 for 220-1202, but you will use them at a help desk and may see them in older study material.

copynot on 1202 list

Copies one or more files. No folder trees.

When to use it: a quick single-file copy.

copy C:\Temp\report.txt D:\

xcopynot on 1202 list

Copies files and folder trees. /s copies subfolders, /e includes empty ones. Microsoft treats it as legacy; robocopy is its replacement.

When to use it: older scripts. Prefer robocopy for new work.

xcopy C:\Source D:\Dest /e /i

shutdownnot on 1202 list

/s shuts down, /r restarts, /t sets a delay in seconds, /f forces apps to close, /a aborts a pending shutdown.

When to use it: scheduling a restart after hours, or restarting a remote PC.

shutdown /r /t 0
shutdown /s /t 3600
shutdown /a

08 / CHECK YOURSELF

Scenario quiz

Pick the best command for each ticket. The explanation appears after you answer.

Command list checked against the CompTIA A+ Core 2 (220-1202) Exam Objectives, version 2.0, objective 1.5. Switch behavior reflects Windows 10 and Windows 11. CompTIA and A+ are trademarks of CompTIA, Inc.; BB Tech Tools is not affiliated with CompTIA.