Skip to content

As an Amazon Associate I earn from qualifying purchases. How links work

Hardware Repair Guides

GuidesTools

Commands to Run on a Sick PC (and the Ones That Erase a Disk)

Safe Windows commands for a sick PC: check the disk, DISM then sfc, battery report, memory test, network reset. Plus a danger box for the lines that erase a disk.

By Andrew Musselman · October 10, 2026 · 20 min read

Affiliate links. I may earn a commission at no extra cost to you. #ad

People send a text file and say run all of it. I won’t. Command Prompt does have a fixed set of built-in commands. That set is the tables below, and the ones that delete are split into the danger box so they don’t sit next to dir. help prints a mix, built-ins plus programs like chkdsk and format, and it still skips some. Linux has no list like that. A live USB already has more programs than this page, and one install adds more. The Linux half is what I type when Windows won’t boot, not every program that exists.

Open the right window

diskpart needs the title bar to say Administrator, or it answers access denied. Right-click Command Prompt, Run as administrator. dir and the other built-in commands don’t care. An underlined command opens the manual in a new tab. It does not type the line for you.

A few of the old commands moved. wmic still runs on a lot of Windows 10 boxes. Windows 11 24H2 and later don’t include WMIC. Microsoft removed it, and it can’t be added back. If it says not recognized, that’s why. I don’t go install a feature just to get that word back. I open PowerShell as admin and use the line I wrote under it. Linux checks are from a live USB, the “try it” desktop, not an install. If the installer is the button you can see, you clicked the wrong one.

What each check is for

What you seeWhat I typeWhat I don’t buy yet
Windows boots. I need to know if the disk is even thereecho list disk | diskpartA new SSD. List it first. The NVMe post is the seating job.
Windows will not boot, so there is no promptA Linux live USB, then lsblkA motherboard. I still haven’t seen the disk from outside Windows.
Disk shows up, but it hesitates or files corruptCrystalDiskInfo, or smartctl from the live USBchkdsk /r. That one grinds a weak disk for hours.
Laptop, and I want a number on the packpowercfg /batteryreport, saved to the desktopA new battery because the report looks ugly. Look at the pack. Swollen is the other guide.
Random crashes, and the disk’s SMART is cleanWindows Memory Diagnostic is a hint. MemTest if it finds something, or the crashes keep comingMore RAM. The RAM post is the order.
Windows files are broken and the disk is healthyDISM /RestoreHealth, then sfc /scannow againThose two for a drive that isn’t in BIOS. They can’t see hardware that setup can’t see.

Is the disk on the list

From an admin Command Prompt this prints the disks Windows can see, then quits. I use it because it doesn’t leave me sitting inside diskpart where the next word might be clean.

  • echo list disk | diskpart
  • A disk with a size, and a star under the GPT column or not, is a disk this Windows can see. No row means this Windows doesn’t see the stick. It does not mean the BIOS page is blank. Look for the model name the way the NVMe guide starts. Name there, diskpart empty: driver or VMD, not a new motherboard. Name nowhere: seating and slot, same guide.
  • list disk doesn’t print letters. Look at Free. If Free is almost the whole Size, nothing is partitioned yet. That can be a blank stick, or a disk Windows can see and still can’t read. Blank is not dead. Letters are echo list volume | diskpart. The little recovery and EFI rows normally have none. Don’t format from either screen if you think the files are still on it.

If diskpart says access denied, you aren’t admin. wmic saying it isn’t recognized is a different message, and it is not a cue to install anything. If you want the PowerShell version:

Linux, from the live desktop, once, so I don’t guess the device name:

  • lsblk -o NAME,SIZE,MODEL,TRAN,MOUNTPOINT
  • TRAN says how it is attached. nvme, sata, or ata are internal. ata is an older controller, still the internal disk. usb is every USB disk, including the stick you booted. Don’t run the next command at the usb row.
  • No row for the internal stick means this boot didn’t get it. If BIOS shows the model name, don’t buy a board. If the name isn’t in BIOS either, seating and slot, same NVMe guide. A command will not create a socket.

Is it dying, without “fixing” it

Command Prompt has no SMART reading I trust. wmic diskdrive get status sits on OK right up until the day it doesn’t, and then it’s late. I open CrystalDiskInfo. Same tool as the lifespan post. Caution or Bad means stop and copy.

From the Linux USB, smartmontools is the one that actually reads it. The package is not on every live image. If the command is missing I don’t go install it. On a try-desktop that install sits in RAM and disappears at reboot anyway. I boot an image that has it, or I use CrystalDiskInfo from a Windows box and a USB enclosure.

  • sudo smartctl -H /dev/nvme0
  • sudo smartctl -a /dev/nvme0
  • lsblk prints nvme0n1. smartctl wants the controller, /dev/nvme0. If the row is nvme1n1, that’s /dev/nvme1. Don’t add p1. That’s a partition.
  • Match the row. A SATA disk is the one whose TRAN says sata or ata, not whichever letter a forum post used. The live USB is the usb row, and on an NVMe-only machine that stick is often sda.
  • smartctl -H saying PASSED is one warning bit. It is not the all-clear in the lifespan post. smartctl -a is the reading I look at. No percent cutoff.
  • I/O errors in sudo dmesg while that runs means I stop. Copy what’s still readable. The clone guide names ddrescue for that, and the image has to land on a different disk. I don’t paste a dd line in here. One wrong device name wipes the wrong drive.

chkdsk with no switches is a read-only look at the file-system records. It doesn’t fix anything. chkdsk /r is the long grind, and it implies a fix pass. I don’t run either one when the disk already hesitates. fsck on Linux is the same urge. File-system checks are for a dirty shutdown on a disk that still passes SMART. Not for a disk that’s vanishing.

The battery number, and what it doesn’t mean

Admin Command Prompt, not PowerShell. In PowerShell that %userprofile% does not expand. I send the file to the desktop because an admin Command Prompt starts in System32, and people never find the report that landed there.

  • powercfg /batteryreport /output "%userprofile%\Desktop\battery-report.html"
  • Open that file. Design capacity is what it shipped with. Full charge capacity is what it holds now. I look harder when full charge is a lot lower than design. I still look at the pack before I buy one.
  • A pillow, a lifted trackpad, a cover that won’t sit down: stop. That’s Swollen laptop battery: stop using it, then replace it. The report is not the test for that.
  • A desktop will run the command and tell you there’s no battery. That’s not a fault.

Linux can do the same job with upower -e and then upower -i on the BAT device it prints. Compare energy-full to energy-full-design. Some packs say charge-full and charge-full-design instead. Same comparison. Ignore the line that just says capacity. That’s a percent of the current full charge, not of the design number. A lot of live USBs don’t have upower running. I don’t fight that. The Windows report is the one I use when the laptop still boots.

Temps and RAM, the commands that aren’t

There isn’t a Command Prompt temperature I will bet a paste job on. The old WMI thermal-zone number is the wrong unit on a good day, and on a laptop it often isn’t the CPU. If it’s hot, that’s Laptop running hot: vents, fan, then paste. BIOS, or a tool that names the sensor. Not a command I found in a list.

mdsched.exe reboots into Windows Memory Diagnostic. One pass is a hint. It is not the overnight test. If it finds something, or the crashes keep coming and the disk is clean, I go to How to tell RAM is failing before you buy more of it and boot MemTest86. I don’t add a stick because Task Manager said 8GB.

When the disk is fine and Windows isn’t

Only after SMART is boring and the machine still boots. Admin prompt. DISM first, then sfc. sfc copies replacement files out of the local store, so a rotten store makes sfc shrug. DISM repairs that store. Then sfc again, otherwise the shrug is the last word.

  • DISM /Online /Cleanup-Image /ScanHealth only looks. RestoreHealth is the fix.
  • DISM /Online /Cleanup-Image /RestoreHealth
  • sfc /scannow
  • DISM wants the network up so it can pull clean files. No Wi-Fi, it often just fails. That’s not a dead SSD.
  • Neither command puts a drive back into BIOS. If the model name was never on the storage page, you’re in the NVMe guide.

When the internet is the sick part

Admin prompt. The PC boots, and the browser can’t find sites.

  • ipconfig /flushdns clears the DNS cache. Safe.
  • netsh winsock reset, then reboot. A VPN app may need reinstalling after.
  • netsh int ip reset, then reboot.
  • Neither one fixes a dead Wi-Fi card.

Every command built into Command Prompt

These are inside cmd.exe. They are not separate programs. The tables plus del and rd in the danger box are the whole built-in set. cd and chdir are one command. del and erase are one command. Microsoft’s longer command index also lists Server tools, and words that only work after you are already inside diskpart. I left those out. clean typed at C:\ is not a command. clean inside diskpart is, and that one is in the danger box.

CommandWhat it’s for
dirLists the folder you’re in.
cd, chdirChanges folder. cd /d E: changes the drive too.
clsClears the window. Nothing on the disk.
typePrints a text file. Don’t point it at a giant binary and expect a story.
verThe Windows version string. Thin, but it’s the real one.
volThe label on a drive letter.
echoPrints a line. In a batch file, echo off hides the commands as they run.
titleRenames the window.
colorWindow colors. color with nothing after it puts them back.
promptChanges the text at the start of each line.
exitCloses the window.
pathTyped alone, shows where Windows looks for programs. Don’t set it to empty.
setTyped alone, prints variables. set PATH= with nothing after the equals blanks that search list.
verifyOld command for whether copy double-checks. I leave it.
CommandWhat it changes
copyCopies a file. If that name already exists, it can overwrite it.
moveMoves a file. Same overwrite problem.
ren, renameA new name. Two files in one folder can’t share it.
md, mkdirMakes a folder.
mklinkMakes a link the file system treats as real. I don’t make one to fake a missing file.
assocWhich program opens an extension. A wrong one opens your files in the wrong app.
ftypeThe open command for that file type. The other half of assoc.
dateShows the date. Setting a wrong one breaks sites and updates until the clock is right.
timeSame for the clock. I don’t set it to test a theory.
pushdGoes to a folder and remembers the old one.
popdGoes back to what pushd remembered.
startOpens a program or a folder in another window.
CommandThe rest of the built-in set
breakAn old Ctrl+C toggle. On a current Windows box it doesn’t change the job.
callRuns a batch file and comes back.
forA loop. I don’t paste one. for pointed at del is how a short script deletes more than the one file.
gotoJumps to a label inside a batch file.
ifA test inside a batch file.
remA comment. The computer skips the line.
shiftSlides the batch file’s arguments along.
setlocalKeeps a batch file’s variables inside that file.
endlocalEnds setlocal.
pauseWaits until you press a key.

External commands that are on a home PC

These are separate programs, usually in System32. help prints some of them and skips others. ping is one it skips. This is still not every file in that folder, and it is not the Server list. Domain tools, old backup programs, and commands Windows only adds if you turn a feature on are not here. If the window says it isn’t recognized, the program isn’t on this PC. Don’t go install a pile of optional features to complete the list.

CommandWhat I use it for
ipconfigIs the adapter listed, and did it get an address.
pingDoes one address answer. ping 127.0.0.1 only proves Windows answered itself.
tracert, pathpingThe route to an address. Not a dead-disk test.
netstatConnections this PC has open. Not a parts test.
systeminfoOS, RAM amount, BIOS date. It’s slow.
driverqueryA long driver list. A long list is not a diagnosis.
tasklistWhat’s running.
taskkillStops one process. The wrong one just closes a program. It does not fix a disk.
whoamiWhich account this window is. A standard user can’t read some folders and calls it a missing disk.
hostnameThe PC’s name.
whereWhich file Windows would run for a command name.
msinfo32Opens the System Information window.
getmacThe adapter’s MAC address. I rarely need it.
sfcRepairs Windows files. Already covered. After DISM, and only if the disk is healthy.
DISMRepairs the store sfc copies from. Wants the network. Doesn’t put a drive in BIOS.
powercfgThe battery report. Already covered.
chkdskNo switches is a look at the file-system records. /r is in the danger box.
chkntfsWhether Windows will check the disk at the next boot. I don’t tell it to skip one.
diskpartlist disk and list volume are the safe lines. clean is not. It’s in the box.
robocopyCopies a folder that still opens. Set the retry count low. The default will sit there forever on a dying file.
xcopyThe older copy. I use robocopy.
treeA picture of the folders.
find, findstrSearch text.
fcCompare two files.
compAn older compare.
morePages a long printout.
clipPuts the command’s output on the clipboard.
sortSorts lines of text.
attribHidden and read-only flags. I don’t clear system flags on a Windows folder.
compactNTFS compression. I don’t turn it on to make room on a disk that’s already sick.
labelRenames the volume. I don’t, while I’m still trying to tell disks apart.
substMaps a folder to a drive letter. Handy, and also a good way to forget which disk you meant.
mountvolShows mount points. I don’t delete one to tidy up.
netA family. net user, net share, and more. I don’t make an account off a screenshot.
scsc query shows a service. sc delete removes one. I don’t delete a service because a post called it leftover.
schtasksScheduled tasks. I don’t delete them from a list I don’t recognize.
shutdownshutdown /s turns off. shutdown /r reboots. shutdown /r /o reboots into Advanced Startup: Startup Repair, Safe Mode, System Restore. That's all I use it for.
gpresultWhich policies applied. On a home PC that isn’t in a domain, it’s usually a short nothing.
choice, timeout, doskey, modeBatch menus, a wait, command history, and console settings. Not a hardware test.
cmdOpens another Command Prompt.
helpPrints a mixed list, built-ins plus a lot of these programs. It is not the whole of either list. help dir still prints the switches.
wmicOften missing on newer Windows 11. I don’t install it. The PowerShell line is Get-Disk, above.

Linux commands on a live USB

No command prints every Linux program. These are the ones on a normal live desktop that answer the same questions as the Windows list. cp and mv copy and move, and they overwrite a file that already has the name. They are not how I clone a dying disk. sudo runs the next word as root. sudo is not the dangerous part. The next word is.

CommandWhat it’s for
uname -aKernel name. Tells me the USB actually booted.
cat /etc/os-releaseWhich distro this live desktop is.
pwdThe folder I’m in.
lsLists a folder. The Linux dir.
cdChanges folder.
catPrints a text file.
lessSame, one page at a time.
df -hFree space on what is mounted.
du -hHow big a folder is.
free -hRAM the system can see.
lsblkDisks, and whether each one is nvme, sata, ata, or usb. Already covered.
blkidFilesystem type. A look. I don’t pass it a switch I found in a post.
findmntWhat is mounted, and where.
mountWith no extra words, the same kind of look. I don’t give it a device and a folder off a screenshot.
dmesgKernel messages. I/O errors here mean I stop and copy.
lspciDevices on the PCI bus.
lsusbUSB devices the kernel sees.
lscpuThe CPU.
ip linkAdapters, up or down.
ip addrAddresses. The Linux ipconfig.
pingDoes one address answer.
psWhat’s running.
smartctlThe SMART read. Already covered. Match the device to the lsblk row.
upowerBattery full against design, when the live image has it.

If Windows never gives you a prompt

Then every Windows line above is useless. I boot a live Linux USB, pick the option that tries the system, and run lsblk. I do not click Install. Install onto the internal disk is how the files you were trying to read get replaced. The USB is the tool. The sick disk stays a disk I only read.

What I'd use

A 32GB USB 3 stick for a live Linux session

This is how I run lsblk and smartctl when Windows won’t open. 32GB is enough for a live image. The brand matters less than not installing that image onto the drive you’re diagnosing.

  • Use the distro’s own writing instructions. Rufus and balenaEtcher both work if you pick the live image and not your internal disk.
  • Unplug extra drives before you write the USB if you tend to click the wrong target.
Check price on Amazon(paid link)

What I'd use

USB enclosure for NVMe/SATA

This is how I read a stick the motherboard won’t show. A SATA-only board will not see an NVMe stick. Some enclosures do both. Match the drive you pulled.

  • If it doesn’t say NVMe or PCIe, treat it as SATA-only.
Check price on Amazon(paid link)

What I'd use

External drive to copy to

The copy has to land on a different disk. A 1TB external is the bucket. It is not the repair.

  • If the sick disk already clicks, stop. The clone guide is the copy. A normal copy hangs on the bad file.
Check price on Amazon(paid link)

Verdict

List the disk. Read SMART. Don’t chkdsk a drive that’s already dying. Battery report for a worn pack, eyes for a swollen one. DISM, then sfc, only after the disk looks fine. Anything with clean, format, or of= stays untyped.

Keep going

Keep fixing