bcdboot to copy the necessary boot files from the Windows directory to the EFI System Partition. This method restores the ability of UEFI firmware to locate and launch the operating system without requiring a full OS reinstallation or third-party repair tools.
Accessing the Recovery Environment
The first step in repairing a missing bootloader is gaining access to a command-line interface that can interact with your disk structures. Since the operating system cannot boot normally, you cannot use built-in Windows utilities likebootrec.exe from within the desktop environment. Instead, you must utilize the Windows Setup environment.
Insert a bootable Windows installation USB drive into your computer. Restart the machine and enter the BIOS/UEFI settings to ensure the USB drive is set as the primary boot device. Once the Windows Setup screen appears, do not proceed with installing Windows. Click on "Repair your computer" located in the bottom-left corner of the window. Navigate through the menu by selecting "Troubleshoot," then "Advanced options," and finally choosing "Command Prompt." This action opens a black window where you can execute low-level disk commands. It is crucial to verify that you are running these commands with administrative privileges, which is the default state in this environment. If the prompt does not show C:\Windows\System32>, you may need to navigate to the correct directory, but usually, the setup environment provides direct access to the required tools.
Identifying Drive Letters
One of the most challenging aspects of manual bootloader repair is mapping drive letters correctly. In the Windows Setup environment, drive letters often differ from those assigned in the installed operating system. For example, your main Windows partition might appear asD: instead of C:, and the EFI System Partition (ESP) might not be assigned a letter at all initially. You must identify these partitions accurately before attempting to write boot files.
Open the Command Prompt and type diskpart to launch the DiskPart utility. Once inside, type list vol to display all volumes on the system. Look for a small volume (typically 100MB to 500MB) formatted as FAT32; this is your EFI System Partition. Note its volume number. Next, look for the largest volume, which likely contains your Windows installation. It will typically be formatted as NTFS.
Assign a temporary drive letter to the EFI partition so you can reference it easily. Type select vol X (replace X with the volume number of the EFI partition), then type assign letter=S. You can choose any available letter, but S is commonly used to avoid conflicts. Similarly, if your Windows partition does not have a standard letter, select it and assign it C or another convenient letter. Type exit to close DiskPart and return to the regular Command Prompt. Verify your assignments by typing dir C: and dir S: to ensure they point to the correct data.
Rebuilding the Boot Configuration Data
With the correct drive letters identified, you can now regenerate the boot files. The primary tool for this task isbcdboot, which copies the boot files from the Windows installation to the target partition and creates a new boot configuration store. This command effectively reinstates the bootloader entries that were lost when the boot partition was deleted.
Assuming your Windows folder is on C: and your EFI partition is on S:, execute the following command: bcdboot C:\Windows /s S: /f ALL. The /s S: flag specifies the target system partition (the EFI partition). The /f ALL flag ensures that boot files are created for both UEFI and Legacy BIOS modes, providing maximum compatibility. If your system uses only UEFI, you can use /f EFI instead.
After executing the command, check the output. A successful execution will display messages indicating that the startup files were created successfully. If you encounter errors such as "File not found" or "Access denied," double-check your drive letter assignments. Ensure that the path to the Windows folder is correct and that the EFI partition is indeed formatted as FAT32. If the command fails, you may need to manually format the EFI partition using DiskPart before retrying, though this should rarely be necessary if the partition still exists.
Verifying and Finalizing
Once thebcdboot command completes successfully, you should remove the temporary drive letter assignment to keep the system clean. Re-enter DiskPart by typing diskpart, then run select vol X (selecting the EFI partition again) and remove letter=S. Exit DiskPart and close the Command Prompt.
Restart your computer by removing the installation media. The system should now boot directly into Windows. If it does not, enter the BIOS/UEFI settings and ensure that the Windows Boot Manager is listed as the first boot option. If you have a dual-boot setup involving Linux or other operating systems, you may need to adjust the boot order or update the GRUB configuration to recognize the newly restored Windows bootloader. For more complex scenarios involving dual-boot systems, consider reviewing guides on regenerating Windows boot files in EFI dualboot setups.
Frequently Asked Questions
What if my EFI partition is not FAT32?
The EFI System Partition must be formatted as FAT32 to store boot files correctly. If your partition is NTFS or exFAT, the bcdboot command will fail. You can reformat the partition using DiskPart, but be aware that this erases existing data on that specific partition. Always backup important data before formatting.
Can I use bootrec.exe instead of bcdboot?
bootrec.exe is primarily designed for fixing legacy MBR-based boot issues and may not work reliably for modern UEFI systems with deleted ESP contents. bcdboot is the recommended tool for UEFI because it explicitly copies the necessary firmware boot files and creates a fresh BCD store. Use bootrec only if bcdboot fails and you suspect deeper corruption.
Why did my drive letters change in the recovery environment?
The Windows Setup environment assigns drive letters dynamically based on the order partitions are detected during boot. This differs from the installed OS, which uses persistent labels and registry entries. Always rely on list vol and partition sizes/formats to identify drives rather than assuming standard letters like C or D.
Will this process delete my personal files?
No, reinstalling the bootloader using bcdboot only affects the EFI partition and the boot configuration data. Your user files, applications, and the Windows installation itself remain untouched on the main NTFS partition. However, always maintain backups to protect against unexpected hardware failures or accidental deletions.
What if I still cannot boot after running bcdboot?
If the system fails to boot, check your BIOS/UEFI settings to ensure Secure Boot is enabled if required by your hardware, and verify that Windows Boot Manager is the primary boot entry. Additionally, ensure that the time and date settings in BIOS are correct, as incorrect dates can sometimes prevent secure boot validation.