sodcalculator

10 Tech How-To

Fix Windows Boot Errors with Command Prompt

Guide 10-23974 · Updated · Step by step

This guide shows you how to repair common Windows boot errors—like a black screen, automatic repair loop, or the dreaded “INACCESSIBLE_BOOT_DEVICE”—using the Command Prompt in the Windows Recovery Environment. You’ll run a series of built-in commands that fix the master boot record, rebuild the boot configuration data, and check system file integrity. You’ll need a Windows installation media (USB or DVD) or access to the recovery menu, and about 30 minutes.

What You’ll Need

  • A Windows installation USB or DVD (same version as your installed Windows, e.g., Windows 10 or 11). If you don’t have one, you can create it on another computer using Microsoft’s Media Creation Tool.
  • A working keyboard and mouse.
  • Basic familiarity with typing commands (you’ll type a few lines).

Step-by-Step

  1. Boot into Windows Recovery Environment. Insert your installation media, restart your PC, and press the key to open the boot menu (usually F12, F2, Esc, or Del—check your PC’s manual). Select the USB/DVD drive. When the Windows Setup screen appears, click “Next,” then click “Repair your computer” in the bottom-left corner. If you can’t boot from media, try restarting your PC 3 times, forcing it to interrupt startup and enter the recovery menu automatically.
  2. Open Command Prompt. In the recovery environment, go to “Troubleshoot” > “Advanced options” > “Command Prompt.” A black window with a command line will open.
  3. Identify your Windows drive letter. In the Command Prompt, type diskpart and press Enter. Then type list volume and press Enter. You’ll see a list of volumes. Look for the one with the label “System Reserved” (usually 100-500 MB, often drive C: or D:). Note its drive letter. Also note the drive letter of your actual Windows installation (usually C: but it might be D: or E:). Type exit to leave DiskPart.
  4. Run Bootrec commands. Type the following commands one by one, pressing Enter after each. These rebuild the master boot record and boot configuration data. Replace C: with your actual Windows drive letter if different.

    bootrec /fixmbr

    bootrec /fixboot

    bootrec /scanos

    bootrec /rebuildbcd

    If you get an “Access is denied” error on /fixboot, skip to step 5 first, then come back.
  5. Rebuild the BCD manually (if needed). If bootrec /rebuildbcd fails or doesn’t find your Windows installation, type these commands to manually rebuild the boot configuration data. Replace C: with your Windows drive letter.

    bcdedit /export C:\BCD_Backup

    ren C:\boot\bcd bcd.old

    bootrec /rebuildbcd

    When prompted to add the installation to the boot list, type Y and press Enter.
  6. Check for disk errors. Type chkdsk C: /f /r (replace C: with your Windows drive) and press Enter. This scans for and repairs file system errors and bad sectors. It may take a while—let it finish. If it says the drive is in use, type Y to schedule it and run it on next restart.
  7. Run System File Checker. Type sfc /scannow and press Enter. This checks and repairs corrupted system files. It can take 15-20 minutes. If it finds errors it can’t fix, run DISM /Online /Cleanup-Image /RestoreHealth (only works if Windows is installed on the drive you’re repairing).
  8. Exit and restart. Type exit to close Command Prompt, then click “Continue” or “Restart” to boot normally. If it still fails, repeat the bootrec commands in a different order or try the troubleshooting tips below.

Common Mistakes

  • Using the wrong drive letter. In the recovery environment, drive letters can be different from what you see in Windows. Always verify with diskpart first.
  • Skipping the /scanos step. This tells you if Windows is actually detected. If it finds nothing, your Windows installation may be damaged beyond these repairs.
  • Running chkdsk on the wrong volume. Running it on the System Reserved partition instead of the Windows drive will not fix boot errors.
  • Not waiting for commands to finish. chkdsk and sfc can take a long time. Interrupting them can cause more damage.
  • Ignoring error messages. If a command returns an error, read it carefully. It often tells you exactly what’s wrong (e.g., “The system cannot find the path specified” means you used the wrong drive letter).

Tips

  • Always back up your data before running repairs if you can. If you can’t boot, you can use a live Linux USB to copy files to an external drive.
  • Run the commands in the order given. bootrec /fixmbr and /fixboot are safe and quick; they fix the most common boot issues.
  • If you have a dual-boot system (e.g., Windows and Linux), the bootrec commands may remove the Linux boot entry. You’ll need to re-add it later.
  • After running bootrec /rebuildbcd, if it finds your Windows installation, type Y to add it. If it doesn’t, you may need to use bcdboot instead: bcdboot C:\Windows /s S: (where S: is the System Reserved drive letter).
  • Keep your Windows installation media handy. You’ll need it for any future repairs.

Troubleshooting

If the steps above don’t fix your boot error, try these additional measures:

  • If bootrec /fixboot gives “Access is denied”: This often happens when the BCD is corrupted. Use the manual BCD rebuild in step 5 first, then try /fixboot again.
  • If bootrec /rebuildbcd doesn’t find Windows: Use bcdboot C:\Windows (replace C: with your Windows drive) to recreate the boot files directly. This is often more reliable.
  • If you still see a blue screen or black screen: Try Startup Repair from the Advanced options menu. It automates many of these commands and can fix issues you might have missed.
  • If commands fail with “The system cannot find the file specified”: Double-check your drive letters. In the recovery environment, the Windows drive might be D: or E:. Use diskpart to list volumes and identify it by size and label.
  • If you suspect a hardware issue: The commands won’t fix a failing hard drive. Run a hardware diagnostic from your PC’s manufacturer (often accessible via F12 or Del at boot).
  • If nothing works: You may need to perform a Windows repair install (in-place upgrade) using your installation media, which keeps your files and apps. Choose “Upgrade” instead of “Repair” on the setup screen. If that fails, a clean install is the last resort.

Frequently Asked Questions

Will these commands delete my personal files?

No. The commands in this guide only repair boot files and system files. Your personal documents, photos, and installed programs remain untouched.

What does “bootrec /fixmbr” actually do?

It rewrites the master boot record (MBR) to match the Windows boot loader. It does not touch your partitions or data. It’s a safe first step to fix boot issues.

Why do I need Windows installation media? Can’t I just use the recovery menu?

If your PC can enter the recovery menu (by pressing F11 or via the automatic repair loop), you can access Command Prompt without media. But if Windows is severely corrupted, the recovery menu may not load, so having installation media is a reliable backup.

How long does chkdsk take?

It depends on the size of your drive and the number of errors. It can take anywhere from 10 minutes to several hours. Let it run overnight if needed.

Can I use these commands on Windows 7, 8, or 10?

Yes, the commands are the same for Windows 7 through 11. The recovery environment may look slightly different, but the Command Prompt options are identical.

What if I get “Element not found” when running bcdedit?

This usually means the BCD store is missing or unreadable. Use the manual rebuild in step 5, or try bcdboot C:\Windows to recreate it from scratch.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →