Editorial

How to Repair Windows Bootloader Using Command Prompt

Avatar photo
Written by Oliver

Learn how to repair the Windows bootloader using Command Prompt with this step-by-step guide for both MBR and GPT partition styles.

If your Windows PC fails to boot due to a corrupted bootloader, you can often resolve the issue using the Command Prompt from the Windows Recovery Environment (WinRE). This guide provides a step-by-step approach to repairing the Windows bootloader, applicable to both MBR (Master Boot Record) and GPT (GUID Partition Table) partition styles.

Prerequisites

Before proceeding, ensure you have:

  • A bootable Windows installation media (USB or DVD).
  • Knowledge of your system’s partition style (MBR or GPT).

Step-by-Step Guide to Repair the Windows Bootloader

  1. Access the Windows Recovery Environment (WinRE)
  1. Insert the Windows installation media into your PC.
  2. Restart your computer and boot from the installation media.
  3. On the Windows Setup screen, select your language preferences and click Next.
  4. Click on Repair your computer at the bottom-left corner.
  5. Navigate to Troubleshoot > Advanced options > Command Prompt.
  1. Identify the System Partition

In the Command Prompt:

  1. Type diskpart and press Enter.
  2. Type list volume and press Enter.
  3. Identify the volume labeled as the EFI System Partition (for GPT) or the System Reserved partition (for MBR). Note the corresponding drive letter.
  4. Type exit and press Enter to leave DiskPart.
  1. Repair the Bootloader

For MBR Partition Style

  1. In the Command Prompt, type:

bash

CopyEdit

bootrec /fixmbr

and press Enter.

  1. Then type:

bash

CopyEdit

bootrec /fixboot

and press Enter.

  1. To rebuild the Boot Configuration Data (BCD), type:

bash

CopyEdit

bootrec /rebuildbcd

and press Enter.

For GPT Partition Style

  1. Assign a drive letter to the EFI partition if it doesn’t have one:

pgsql

CopyEdit

diskpart

list volume

select volume X  (Replace X with the volume number of the EFI partition)

assign letter=Z  (You can choose any available letter)

exit

  1. Navigate to the EFI boot directory:

bash

CopyEdit

cd /d Z:\EFI\Microsoft\Boot\

  1. Repair the boot sector:

bash

CopyEdit

bootrec /fixboot

  1. Rebuild the BCD:

bash

CopyEdit

bcdboot C:\Windows /s Z: /f ALL

Replace C:\Windows with the correct path if your Windows is installed on a different drive.

  1. Exit and Restart
  1. Type exit and press Enter to close the Command Prompt.
  2. Click on Continue to boot into Windows.

Additional Tips

  • If you encounter an “Access is denied” error during bootrec /fixboot, ensure that the EFI partition is properly assigned a drive letter and formatted with the FAT32 file system.
  • Use the bcdedit command to view and manage the boot configuration data.
  • Always back up important data before performing system repairs.

Conclusion

Repairing the Windows bootloader using the Command Prompt is a straightforward process when following the correct steps. Whether your system uses MBR or GPT, the above guide provides the necessary commands to restore your PC’s boot functionality. Always ensure you have a backup of your data and the appropriate installation media before proceeding with system repairs.

About the author

Avatar photo

Oliver

Oliver is a professional blogger who writes about health and technologies to inspire their audience.