A blue screen of death (BSOD) means Windows hit an error it couldn’t recover from, usually caused by a bad driver, corrupted system files, disk errors, or faulty memory. Command Prompt gives you a set of built-in tools to repair most of these, even when Windows won’t start normally. This guide shows which commands to run, in what order, how to reach Command Prompt from recovery when you can’t sign in, and how to read the error code so you fix the right thing.
Quick Answer
Open Command Prompt as administrator and run these, one at a time:
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannow
chkdsk C: /f /r
Restart after chkdsk. If the blue screen continues, check the stop code and update or roll back the driver it points to.

Step 1: Note the Stop Code
The blue screen shows a stop code such as CRITICAL_PROCESS_DIED, IRQL_NOT_LESS_OR_EQUAL or MEMORY_MANAGEMENT, and sometimes a file name like nvlddmkm.sys. A driver file name tells you which driver to update or remove. After restarting, you can also find the error in Event Viewer > Windows Logs > System, and crash dump files are saved in C:\Windows\Minidump.
Step 2: Open Command Prompt
If Windows starts: type cmd in Start, right-click Command Prompt, and choose Run as administrator.
If Windows won’t start: Windows opens the recovery environment after two or three failed boots. Or hold Shift and click Restart on the sign-in screen. Then go to Troubleshoot > Advanced options > Command Prompt. You can also boot from Windows installation media and choose Repair your computer. If BitLocker is on, have your recovery key ready.
Step 3: Repair the Windows Image With DISM
DISM /Online /Cleanup-Image /RestoreHealth
DISM downloads clean copies of damaged system components from Windows Update, so it needs an internet connection. It can take 10 to 30 minutes and may appear stuck at 20% or 62%; let it finish. This command is for a running Windows only; use the offline commands in Step 6 from recovery.
Step 4: Scan System Files With SFC
sfc /scannow
System File Checker scans protected Windows files and replaces corrupt ones. If it says it found and repaired files, restart and see whether the crashes stop. If it couldn’t fix some files, run DISM again and then SFC a second time.
Step 5: Check the Disk With CHKDSK
chkdsk C: /f /r
/f fixes file system errors and /r locates bad sectors and recovers readable data. Because Windows is using C:, you’ll be asked to schedule it for the next restart; type Y and restart. The scan can take an hour or more on a large drive. Back up important files first if you suspect the drive is failing.
Step 6: Commands to Run From Recovery
In the recovery environment, the Windows drive often has a different letter. Find it first:
bcdedit | find "osdevice"
or type dir D:, dir E: and so on until you see the Windows folder. Then use that letter (D: in these examples):
- Offline SFC:
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows - Disk check:
chkdsk D: /f /r - Repair boot records if the blue screen mentions boot or INACCESSIBLE_BOOT_DEVICE:
bootrec /fixmbr,bootrec /fixbootandbootrec /rebuildbcd. On newer UEFI PCs, /fixboot may return “Access is denied”; in that case, Startup Repair from the Advanced options menu is the simpler fix. - System Restore:
rstrui.exeopens System Restore so you can go back to a point before the crashes started.
Step 7: Boot Into Safe Mode to Remove a Bad Driver
If a recent driver or app causes the crash, start in Safe Mode, which loads only basic drivers.
bcdedit /set {default} safeboot minimal
Restart, then uninstall the problem driver in Device Manager (or roll it back on the Driver tab) or remove the app. When you’re done, turn Safe Mode off and restart:
bcdedit /deletevalue {default} safeboot
Use safeboot network instead of minimal if you need internet access in Safe Mode.
Step 8: Test Memory and Check Drivers
- Memory test: run
mdsched.exeand choose Restart now and check for problems. Errors mean a RAM stick may need replacing. - List drivers:
driverquery /vshows installed drivers and their dates, handy for spotting one that changed right before the crashes. - Uninstall a recent update: from recovery, choose Troubleshoot > Advanced options > Uninstall Updates.
Common Stop Codes and Where to Start
| Stop code | Likely cause | Start with |
|---|---|---|
| CRITICAL_PROCESS_DIED | Corrupted system files | DISM, then SFC |
| IRQL_NOT_LESS_OR_EQUAL | Driver bug | Update or roll back the named driver |
| MEMORY_MANAGEMENT | RAM or driver | mdsched.exe |
| NTFS_FILE_SYSTEM | Disk errors | chkdsk /f /r |
| INACCESSIBLE_BOOT_DEVICE | Storage driver or boot config | Startup Repair, bootrec |
| SYSTEM_SERVICE_EXCEPTION | Driver or security software | Safe Mode, remove recent software |
When Commands Don’t Fix It
- Update Windows and all drivers, especially graphics, chipset and storage.
- Unplug new hardware and USB devices and test again.
- Check for overheating and reset any overclocking.
- Reset Windows from Settings > System > Recovery, choosing Keep my files.
For non-command-line fixes, see how to fix the Windows 10 blue screen. Windows 10 reached end of support on October 14, 2025, so moving to a supported version is also worth considering; these commands work the same in Windows 11.
Frequently Asked Questions
Which should I run first, SFC or DISM?
DISM first, then SFC. DISM repairs the files SFC uses as its source.
Will these commands delete my files?
No. DISM, SFC and CHKDSK repair Windows and the file system without removing personal files, though CHKDSK can’t always recover data from damaged sectors.
How long does chkdsk /r take?
From minutes on a small SSD to several hours on a large hard drive.
Summary
- Note the stop code and any driver name.
- Run DISM /RestoreHealth, then sfc /scannow, then chkdsk /f /r.
- From recovery, use offline SFC, bootrec, or System Restore.
- Use Safe Mode to remove bad drivers, and mdsched.exe to test memory.

Kermit Matthews is a freelance writer based in Philadelphia, Pennsylvania with more than a decade of experience writing technology guides. He has a Bachelor’s and Master’s degree in Computer Science and has spent much of his professional career in IT management.
He specializes in writing content about iPhones, Android devices, Microsoft Office, and many other popular applications and devices.