How-To

How to Repair the Windows 11 Bootloader (MBR/EFI) from Command Prompt

6 min read Editorial

When Windows 11 fails to start and displays a black screen with a blinking cursor, a boot loop, or an error like No bootable device, the bootloader is usually the culprit. The bootloader is the first software that runs when you power on your PC. It loads the operating system from your storage drive into memory. Modern Windows 11 installations rely on either the Master Boot Record (MBR) for legacy BIOS systems or the Extensible Firmware Interface (EFI) system partition for UEFI-based machines. Enterprise editions like Windows 11 Enterprise LTSC follow the same repair procedures.

Before You Start: You will need a working Windows 11 installation USB drive or access to the Windows Recovery Environment. If you do not have either, create one on another computer using the Microsoft Media Creation Tool. Keep your Windows 11 product key handy, and ensure your PC is plugged into a reliable power source throughout the process.

Step 1: Boot into the Windows Recovery Environment

Insert your Windows 11 installation USB drive and restart your PC. You will need to access your firmware boot menu to select the USB drive as the primary boot device. Press the manufacturer-specific key immediately after powering on, typically F12, Esc, F2, or F10. If your system boots straight into Windows, hold down the Shift key while clicking Restart from the Start menu to force the recovery environment. Once the Windows Setup screen appears, select your language and click Next, then choose Repair your computer in the bottom-left corner. This action bypasses the standard installation flow and loads the recovery tools needed for bootloader repair.

Advertisement

Step 2: Open Command Prompt from Advanced Options

Navigate to Troubleshoot > Advanced options > Command Prompt. The recovery environment provides a stripped-down Windows session that runs independently from your primary installation. Clicking Command Prompt launches a C:\Windows\System32> prompt with administrative privileges. You will notice the drive letters may shift in this environment, which is normal because the recovery OS assigns temporary mount points. Do not close this window until you finish all repair commands, as restarting will drop you back into the recovery menu.

Step 3: Identify Your System Partition Layout

Type diskpart and press Enter, then run list vol. DiskPart is a built-in utility that displays every volume on your storage drives. You will see a table showing Volume Number, Drive Letter, Label, File System, and Size. Look for a FAT32 partition labeled EFI, System, or Recovery that is roughly 100 to 500 megabytes. If you do not see a FAT32 partition, your system uses the older MBR layout, and you will instead look for a small unlettered partition marked as System. Note the drive letter assigned to your Windows installation (usually C: or D: in recovery mode) and the letter assigned to the EFI or System partition. This information determines which repair commands will work correctly.

A clean desktop screenshot showing the Windows DiskPart command-line interface displaying a list of volumes with drive l
DiskPart output showing the EFI system partition and Windows drive in the recovery environment.

Step 4: Run Bootrec Commands to Fix the Boot Sector

Type exit to close DiskPart, then run the following commands one at a time:

  1. bootrec /fixmbr
  2. bootrec /fixboot
  3. bootrec /scanos

The /fixmbr command writes a new master boot record to the first sector of your primary drive, replacing any corrupted boot code. The /fixboot command writes a fresh boot sector to the active partition. The /scanos command scans all connected drives for Windows installations and lists them for inclusion in the boot configuration. After running /fixboot, you may see an Access Denied message on UEFI systems. This happens because the EFI partition is locked by the recovery environment. You will resolve this in the next step by mounting the partition explicitly.

Step 5: Rebuild the Boot Configuration Data Store

Type bootrec /rebuildbcd and press Enter. The Boot Configuration Data (BCD) store tells the bootloader where to find Windows files. This command scans your drives for Windows installations and asks whether you want to add them to the boot list. Type Y and press Enter when prompted. If the command returns 0 total Windows installations found, your BCD store is severely damaged, and you will need to recreate it manually using bcdboot in the following step. Wait for the process to finish before proceeding, as interrupting it can leave your system in an inconsistent state.

Step 6: Restore the EFI Bootloader (UEFI Systems Only)

For UEFI-based PCs, type the following commands to recreate the boot files:

  1. diskpart
  2. list vol
  3. select vol X (replace X with your EFI partition number)
  4. assign letter=Z
  5. exit
  6. bcdboot C:\Windows /s Z: /f UEFI

Assigning the letter Z: to the EFI partition gives you a reliable path to write boot files. The bcdboot command copies the necessary boot environment from your Windows folder to the system partition and configures it for UEFI firmware. The /f UEFI flag ensures the correct firmware type is targeted. If you are repairing an MBR system instead, change the flag to /f BIOS. After the command completes, you should see a message confirming that boot files were created successfully. Close the Command Prompt, remove the USB drive, and restart your PC.

A close-up photo of a person's hands resting on a desk next to a powered-on desktop monitor displaying a successful Wind
The system boots normally after the bootloader repair commands complete successfully.

Troubleshooting Common Bootloader Repair Failures

Access Denied when running /fixboot
This error occurs on UEFI systems because the EFI partition is mounted as read-only in the recovery environment. The solution is to skip /fixboot entirely and rely on bcdboot in Step 6, which handles boot sector writing correctly. If you must use /fixboot, run diskpart, select the EFI volume, assign it a drive letter, and then retry the command.

BCD rebuild finds no Windows installations
This usually means the Windows folder is missing, the drive letter is incorrect, or the partition is encrypted. Verify your Windows drive letter in recovery mode by running dir C:\Windows. If the folder does not appear, try D: or E:. If you use BitLocker, you will need your recovery key to unlock the drive before the repair tools can read the installation. Without decryption, the bootloader cannot access the operating system files.

System still fails to boot after repair
If the bootloader commands completed successfully but Windows will not start, the issue likely lies outside the boot files. Check your storage drive health by running chkdsk C: /f /r in the recovery Command Prompt. Corrupted sectors can break the link between the bootloader and the Windows installation. You can also run sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows to repair system files without booting into Windows. If the drive fails disk diagnostics, replace the storage device and perform a clean installation.

Pro Tip: Before making any changes, run bcdedit /export C:\BCD_Backup to save your current boot configuration. If a repair command causes more problems, you can restore the original file with bcdedit /import C:\BCD_Backup. Keeping a backup saves hours of troubleshooting when experimenting with advanced boot settings.

Bootloader corruption happens more often than most users expect, but the built-in recovery tools handle the vast majority of cases. By following these steps in order, you will restore the boot path without losing personal files or reinstalling Windows. If you encounter a firmware-specific error that this guide does not cover, check your motherboard manufacturer’s support page for UEFI boot troubleshooting.

Over to you: Have you ever had to repair your Windows bootloader, and which command saved your system?

Advertisement
Share:
Editorial
Written by
Editorial

Windows & Microsoft news editor at 9to5Windows. Covering everything from Windows 11 builds to enterprise updates.

Advertisement