Free lesson · CompTIA A+ 220-1202 · 4:19

Windows Command-Line Tools: ipconfig, netstat, robocopy, chkdsk, diskpart, sfc and gpupdate

Every Microsoft command-line tool in CompTIA A+ 220-1202 objective 1.5, grouped by job: cd and dir to get around; md, rmdir and robocopy for folders; hostname, whoami, winver, net user and /? for information; ipconfig, ping, tracert, pathping, nslookup, netstat and net use for the network; chkdsk, format and diskpart for disks; and sfc, DISM, gpupdate and gpresult to keep Windows healthy.

Narration uses an AI-generated voice; every lesson is checked against published sources.

What you will learn

  • cd, dir, md, rmdir and robocopy (and what robocopy mirroring deletes)
  • hostname, whoami, winver, net user and command /? help
  • ipconfig, ping, tracert, pathping, nslookup, netstat -ano and net use
  • chkdsk /f and /r, format and diskpart, and why they need care
  • sfc /scannow, DISM RestoreHealth, gpupdate /force and gpresult

PRACTICE TESTS

Ready to drill it?

Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.

See the 30-day pass

Try 10 sample questions

Chapters

  1. 0:00Navigation and files: cd, dir, md, rmdir, robocopy
  2. 0:47Informational: hostname, whoami, winver, net user, /?
  3. 1:15Network: ipconfig, ping, tracert, pathping, nslookup, netstat, net use
  4. 1:53Disks: chkdsk, format, diskpart
  5. 2:25OS management: sfc, DISM, gpupdate, gpresult
  6. 2:58Quick drill and recap

Exam objectives covered

  • Core 2 (220-1202) objective 1.5, Operating Systems

Transcript

Read the full lesson narration

Navigation and files: cd, dir, md, rmdir, robocopy

The command line is often the fastest way to see what's wrong with a Windows computer, and sometimes the only way. Here are the commands CompTIA expects you to know, grouped by job.

Start by getting around. cd changes directory: cd Documents moves into a folder, and cd dot dot moves up one level. dir lists what's in the current folder. To manage folders, md makes a directory, and rmdir removes one; add slash S to remove everything inside it, too. And robocopy copies whole folder trees. It can resume after an interruption, copy NTFS permissions with slash sec, and mirror a folder, which also deletes files that exist only at the destination.

Informational: hostname, whoami, winver, net user, /?

Next, find out what you're working on. hostname prints the computer's name. whoami shows the signed-in account, with its domain or computer name in front. winver opens a window with the exact Windows version and build. net user lists the local user accounts, or shows details for one, like when its password expires. And when you forget a command's switches, type the command, then slash question mark, to see its built-in help.

Network: ipconfig, ping, tracert, pathping, nslookup, netstat, net use

Now the network. ipconfig shows your IP address, subnet mask, and default gateway, and ipconfig slash all adds the MAC address and DNS servers. ping checks whether another device answers. tracert lists each router hop on the way to a destination, and pathping does the same, then measures packet loss at every hop. nslookup asks DNS which address a name resolves to. netstat lists active connections, and netstat dash A-N-O adds listening ports and the process ID behind each one. And net use maps a network share to a drive letter.

Disks: chkdsk, format, diskpart

Disks next. chkdsk scans a volume for file system errors. Add slash F to fix them, and slash R to also find bad sectors and recover what it can read. format builds a new file system on a volume, and the files on it are lost. diskpart manages disks, partitions, and volumes, and its clean command removes all the partitions from the selected disk. format and diskpart can destroy data, so check which disk is selected, twice.

OS management: sfc, DISM, gpupdate, gpresult

Last, keeping Windows itself healthy. sfc, the System File Checker, scans protected system files and repairs them. Run sfc slash scannow from an administrator prompt. If it can't repair something, run DISM with restore health, then run sfc again. On a domain computer, gpupdate applies Group Policy settings that changed, and gpupdate slash force reapplies all of them. gpresult shows which policies actually applied to this computer and user.

Quick drill and recap

Drill time. Say the answer before I do. Which command measures packet loss at every hop? pathping. Show listening ports with their process IDs? netstat dash A-N-O. Repair protected Windows system files? sfc slash scannow. Copy a folder tree and keep its NTFS permissions? robocopy slash sec. Make every Group Policy setting apply again? gpupdate slash force.

Lock in these four. One. Get around and manage folders: cd, dir, md, rmdir, and robocopy. Two. Network: ipconfig, ping, tracert, pathping, nslookup, netstat, and net use. Three. Disks: chkdsk, format, and diskpart, and the last two can destroy data. Four. Keep Windows healthy: sfc, DISM if sfc can't repair, and gpupdate with gpresult.

That's the Windows command line. Now go prove it. Practice questions are waiting for you in Drill Sergeant.

PRACTICE TESTS

Ready to drill it?

Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.

See the 30-day pass

Try 10 sample questions

Related lessons

Found a mistake in a lesson? Email support@drillsgthq.com with the lesson and what is wrong.

Drill Sergeant is an independent study resource. It is not affiliated with, endorsed by, or sponsored by CompTIA, Inc. CompTIA and A+ are trademarks or registered trademarks of CompTIA, Inc.