The setup that breaks you

Install Windows on a second internal drive while the first drive (also Windows) is connected. The installer detects the existing EFI System Partition on disk 0, uses it for the new install's boot entries too, and the shiny new drive becomes the only one with a working boot loader. Pull the second drive out to put it in a different machine, and the first machine suddenly says Winload.efi missing or corrupt.

The fix is to rebuild the BCD and Winload path on the first drive's own EFI partition. It's all one command sequence in the Windows Recovery Environment.

Step 1: Boot into the Recovery Environment

Boot the machine from a Windows installation USB (create one with Microsoft's Media Creation Tool if you don't have one). On the first installer screen, click Repair your computerTroubleshootCommand Prompt.

Drive letters in WinRE are not what you think

The Windows Recovery Environment mounts drives in a different order than a booted system. Your C: might appear as D: or E: here. Always run diskpartlist volume first and find the partition that actually contains \Windows\System32 — that's your real Windows drive.

Step 2: Identify the disk and the EFI partition

diskpart
list disk
sel disk 0             <-- the disk your Windows install lives on

list part
sel part 1             <-- the EFI System Partition (FAT32, ~100-500MB, type "System")

assign letter=V:
exit

You now have the EFI System Partition mounted as V:\. Keep that.

Step 3: Rebuild the boot configuration

bootrec /ScanOS
bootrec /FixMbr
bootsect /nt60 SYS
bootrec /FixBoot
bcdboot C:\Windows /s V: /f UEFI
bootrec /RebuildBcd

The key command is bcdboot:

  • C:\Windows is the path to the Windows installation you want to boot (adjust to whatever letter your actual install came up as).
  • /s V: tells bcdboot which EFI partition to write the boot files to.
  • /f UEFI specifies UEFI firmware type (use BIOS for an old MBR/legacy-boot system, or ALL if you're uncertain).

Exit the prompt and reboot. Remove the installer USB.

Step 4: Clean up extra boot entries

If the rebuild picked up a stale entry for a drive you've removed, you'll see two "Windows 10" options in the boot picker. Try each to find the working one, boot into Windows, and then:

bcdedit /enum              <-- list all entries; note the identifier {GUID} of the bad one
bcdedit /delete {GUID}     <-- remove it

Alternatively, run msconfig, go to the Boot tab, select the dead entry, click Delete, then tick Make all boot settings permanent and apply.

When this doesn't fix it

If bcdboot itself errors with "Failure when attempting to copy boot files," almost always the EFI partition is too small (some OEM layouts ship a 100 MB ESP that can't fit BitLocker recovery files + Windows 11 bootloader). The fastest recovery in that case is to let Windows create a new ESP:

# In diskpart, shrink C: by a few hundred MB:
sel vol C
shrink desired=300

# Then create a new ESP:
create part efi size=260
format quick fs=fat32 label="System"
assign letter=V

# And bcdboot into the new one as before

Windows 11 specifically wants an ESP of at least 100 MB with 50+ MB free at update time. 260 MB is a safe minimum for a modern install.