Windows Boot Repair Guide
Introduction
Windows boot issues can prevent your system from starting correctly, often due to corrupted boot files, misconfigured partitions, or firmware settings. This guide provides step-by-step instructions to repair Windows boot problems for both UEFI and MBR/Legacy systems using the Windows Recovery Environment (WinRE) command prompt. It covers partition setup, boot configuration rebuilding, and troubleshooting common issues.
Prerequisites
- A Windows installation USB or DVD with the same version as your system.
- Access to the Windows Recovery Environment (WinRE) by booting from the installation media and selecting “Repair your computer.”
- Basic familiarity with the Command Prompt.
- Administrative privileges in the recovery environment.
Critical Warning: Verify Partitions Before Formatting
diskpart’s list disk and list part commands to verify that you are selecting the correct disk and partition (e.g., the EFI System Partition or system partition). Formatting the wrong partition can erase your Windows data or other critical files. Always double-check the disk and partition layout to ensure you are not deleting your data drive.Windows Boot Repair
UEFI Boot Repair
UEFI systems use an EFI System Partition (ESP) to store boot files. If the ESP is missing, corrupted, or misconfigured, Windows may fail to boot.
Partition Setup
To prepare or repair the ESP and Windows partition:
diskpart
list disk
rem Verify this is the correct disk
sel disk 0
rem Confirm partition layout (ESP is typically 100-300 MB, FAT32)
list part
rem Select EFI System Partition (ESP) - FAT32
rem Verify this is the ESP
sel part 1
format quick fs=fat32
assign letter=s
rem Select Windows Partition
rem Verify this is the Windows partition
sel part 3
assign letter=c
exit
About the rem lines: diskpart has no # comments. A command followed by # something is rejected (The arguments specified for this command are not valid) and, worse, a rejected sel disk leaves no disk selected - or the previous one. Comments go on their own line and start with rem. Tested with DiskPart 10.0.26100 on Windows 11.
- Explanation:
diskpart: Launches the disk partitioning tool.list disk: Lists all disks to confirm the correct disk number.sel disk 0: Selects the primary disk (replace0with the correct disk number).list part: Displays partitions to identify the ESP (typically 100-300 MB, FAT32) and Windows partition.sel part 1: Selects the ESP (verify it’s the correct partition).format quick fs=fat32: Formats the ESP as FAT32 (only if necessary).assign letter=s: Assigns a drive letter for access.sel part 3: Selects the Windows partition (verify withlist part).assign letter=c: Assigns a drive letter to the Windows partition.exit: Exits diskpart.
Boot Configuration
To rebuild the UEFI boot configuration:
bcdboot c:\Windows /s S: /f UEFI
- Explanation:
bcdboot: Copies boot files from the Windows partition (c:\Windows) to the ESP (S:)./f UEFI: Specifies UEFI firmware type to ensure compatibility.
Proof: Breaking and Repairing a Real ESP
The two blocks above were run exactly as written on a Windows 11 virtual machine (UEFI, GPT) whose EFI System Partition had been emptied on purpose. The screenshots come from an Italian Windows; the commands are the same in every language.
The failure. With the boot files gone the firmware finds nothing to start. This is the message of the VM firmware (OVMF); a physical PC words it differently, or drops straight into its setup screen.

The command prompt. Boot from the Windows installation media and press
Shift+F10on the first screen: a command prompt opens, without going through the repair menus.The partitions.
list partshows the layout the commands assume (ESP = 1, Windows = 3). The ESP is formatted and both partitions get a letter.
The boot files.
bcdboot c:\Windows /s S: /f UEFIanswersBoot files successfully created.The reboot. Remove the installation media and restart: Windows starts normally.

On a virtual machine with a VirtIO disk list disk shows nothing: the installation media has no driver for it. Load it first from the virtio-win ISO (here mounted as E:), then run diskpart again:
drvload E:\viostor\w11\amd64\viostor.inf
Manual EFI Partition Creation
If the ESP is missing, create one:
diskpart
list disk
rem Verify this is the correct disk
sel disk 0
rem Create EFI partition (100MB)
create partition efi size=100
format quick fs=fat32 label="System"
assign letter=S
rem Create Microsoft Reserved (MSR) partition (128MB)
create partition msr size=128
exit
- Explanation:
list disk: Confirms the correct disk.create partition efi size=100: Creates a 100 MB EFI partition. Nooffset=:diskpartplaces and aligns it by itself, on a megabyte boundary.format quick fs=fat32 label="System": Formats the partition as FAT32 with a “System” label.create partition msr size=128: Creates a 128 MB Microsoft Reserved partition (required for UEFI).- Use
bcdboot c:\Windows /s S: /f UEFIafterward to populate the ESP.
MBR/Legacy Boot Repair
MBR/Legacy systems use a different boot process, relying on the Master Boot Record and boot sector.
Standard Boot Repair Commands
Run these commands in the WinRE Command Prompt:
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
- Explanation:
bootrec /fixmbr: Repairs the Master Boot Record to fix boot loader issues.bootrec /fixboot: Writes a new boot sector to the system partition.bootrec /scanos: Scans for Windows installations not listed in the Boot Configuration Data (BCD).bootrec /rebuildbcd: Rebuilds the BCD store to include detected Windows installations.
Alternative Method (if bootrec /fixboot fails with “access denied”)
If bootrec /fixboot fails, use this method:
diskpart
list disk
rem Verify this is the correct disk
sel disk 0
rem Confirm partition layout (system partition is typically 100-500 MB)
list part
rem System partition - FAT32 or NTFS
rem Verify this is the system partition
sel part 1
format quick fs=fat32
assign letter=s
rem Windows partition
rem Verify this is the Windows partition
sel part 3
assign letter=c
exit
rem Rebuild boot configuration for all firmware types
bcdboot C:\Windows /s S: /f ALL
- Explanation:
list diskandlist part: Verify the disk and partition layout to avoid formatting the data drive.- Formats the system partition (typically 100-500 MB) as FAT32 or NTFS (only if necessary).
- Assigns drive letters to access the system and Windows partitions.
bcdboot /f ALL: Creates boot files compatible with both UEFI and BIOS firmware.
Tips and Troubleshooting
Common Issues
- "
bootrec /fixbootaccess denied":- Use the alternative
bcdbootmethod shown above. - Ensure the system partition is active (
activecommand indiskpartfor MBR) or formatted correctly (FAT32 for UEFI).
- Use the alternative
- VHD Compatibility:
- A VHD is partitioned like any other disk once it is attached.
diskparthas nosubformatoption (that one belongs toqemu-img): adding it makes the command fail.create vdisk file="C:\path\to\disk.vhd" maximum=50000 type=fixed attach vdisk convert gpt create partition efi size=100
- A VHD is partitioned like any other disk once it is attached.
- Partition Alignment:
- Do not pass
offset=when creating partitions:diskpartaligns them by itself. An explicitoffset=1(1 KB) falls inside the GPT header area and is refused (There is not enough usable space for this operation). - Verify alignment with
list partindiskpart.
- Do not pass
- Missing Windows Installation:
- If
bootrec /scanosdoesn’t detect Windows, ensure the Windows partition is assigned a letter and containsWindows\System32.
- If
- UEFI vs. BIOS Mismatch:
- Check your system’s firmware settings in the BIOS/UEFI setup to ensure the correct boot mode (UEFI or Legacy).
- Use
/f UEFIfor UEFI systems or/f BIOSfor Legacy systems withbcdboot.
- Data Loss from Formatting:
- Always use
list diskandlist partto confirm you are formatting the correct partition (e.g., ESP or system partition). - Incorrectly formatting the Windows or data partition will result in data loss. Back up critical data before proceeding.
- Always use
Additional Tips
- Backup BCD: Before modifying the BCD, export it:
bcdedit /export C:\BCD_Backup - Verify Disk Layout: Use
diskpart’slist diskandlist partto confirm the correct disk and partition layout before any changes. - Test Boot: After repairs, reboot and test. If issues persist, check firmware settings or re-run
bootreccommands.
Next Steps
In future tutorials, we’ll explore:
- Advanced BCD editing with
bcdedit. - Windows recovery using System Restore and Safe Mode.
- Automating Windows repairs with PowerShell scripts.
Resources
Practice these commands in a test environment to master Windows boot repair, and always verify partitions to avoid data loss!