It’s the moment every PC user dreads. You turn on your computer, expecting the familiar spinning dots of the Windows logo, and instead, you’re greeted by a cold, white-text error on a black screen: "No Boot Device Found" or "An operating system wasn't found."
If you’ve recently messed around with partition managers or tried to set up a dual-boot system, you might have accidentally deleted the EFI System Partition (ESP). This small (usually 100MB) hidden partition is crucial as it holds the boot loaders that tell your motherboard how to start Windows. Without it, your PC has the brains but no idea how to wake up.
Don’t panic. You don’t need to reinstall Windows and lose your data. In this guide, I’ll walk you through manually recreating that partition and getting your system back online.
Prerequisites
Before we dive into the Command Prompt, you will need:
- A Windows Installation Media (USB/DVD): You cannot fix this from inside the broken Windows OS. You need to boot from an external drive. You can create one using the Windows Media Creation Tool on another working PC.
- A Calm Head: We will be using command-line tools that modify your disk structure. Type carefully.
Step 1: Boot into the Recovery Environment
- Insert your Windows Installation USB and boot your PC.
- Enter BIOS/UEFI (usually F2, F12, or Del) and set the USB drive as the primary boot device.
- Now boot form the USB and wait for the Windows Setup screen to appear.
- Then press Shift + F10 on your keyboard to launch the Command Prompt. It should open instantly.
Note: If that doesn't work, you can take the long way: Click Next > then "Repair your computer" (bottom left) > Troubleshoot > Advanced options > Command Prompt.
Step 2: Identify Your Disk and Partitions
We need to use the diskpart tool to manipulate the hard drive partitions.
-
In the command prompt, type:
diskpart -
List your disks to find your main drive:
list diskLook for the disk that matches your main hard drive's size (e.g., 500GB or 1TB). In most cases, this is Disk 0.
-
Select your disk:
select disk 0(Replace 0 with your actual disk number).
-
Check for unallocated space:
list partitionIf you deleted the EFI partition, you likely have some unallocated space. If you don't see unallocated space, you might need to shrink your main Windows partition by 100MB to make room, but let’s assume you have the space for now.
Step 3: Create the New EFI Partition
Now we will create the partition, format it, and assign it a letter so we can write files to it.
- Create the partition (100MB is the standard size):
create partition efi size=100 - Format the partition to FAT32 (UEFI requires FAT32):
format quick fs=fat32 label="System" - Assign a temporary drive letter (we'll use 'S' for System):
assign letter=S - Exit diskpart (but stay in the command prompt):
exit
Step 4: The Magic Command (BCDBoot)
This is the most critical step. We need to copy the boot files from your Windows installation to this new empty partition.
-
First, figure out which letter your Windows installation is using. In the Recovery Environment, your drive letters often shift. Your standard "C:" drive might show up here as D: or E:. You need to check them manually to find the right one.
Type the following commands one by one until you find your main drive:
dir c: dir d: dir e:Look through the output for the Windows and Users folders. You have found the correct drive when you see them.
Note: If C: looks empty or only has a Recovery folder, try the next letter (D:, E:, etc.). Also, check the free space at the bottom of the text; your main Windows drive will usually be the largest one.
For this tutorial, let's assume we found these folders on C:.
-
Run the BCDBoot command:
bcdboot C:\Windows /s S: /f UEFIBreakdown of the command:
- C:\Windows - The source of the clean boot files (Replace C: with the letter you found above).
- /s S: - Targets our newly created S: drive (the EFI partition).
- /f UEFI - Forces it to write firmware compatible with UEFI systems.
If you see the message "Boot files created successfully," you have fixed it!
Step 5: Clean Up and Restart
- Close the Command Prompt window.
- Click "Turn off your PC" or restart manually.
- Unplug your USB drive.
- Boot normally. Windows should load as if nothing ever happened.
Troubleshooting Common Errors
- "Access Denied" on "bootrec /fixboot": If you tried using bootrec commands before this guide and got an error, ignore them. The bcdboot method used above is the modern, robust way to fix UEFI boot issues and bypasses the errors often seen with the older bootrec tool.
- Failure to copy files: Ensure you selected the correct Volume letter for your Windows installation in Step 4. It is very common for the recovery environment to shift drive letters (e.g., your C: drive appears as D:).
Conclusion
Messing with partition tables can be scary, but Windows is surprisingly resilient if you know how to speak its language. By manually rebuilding the EFI partition, you saved yourself hours of re-installing apps and restoring backups.
Last updated on November 25, 2025