Skip to main content
before listing and selecting a volume, one needs to list and select the correct disk (in case there are multiple HDDs/SSDs in the system); cleared up last steps for dual-booting
Source Link
  1. Grab the Media Creation Tool, make yourself a Windows 10 installation DVD or USB drive, and then boot into it.

  2. When prompted, choose "Repair your computer", followed by "Troubleshoot", "Advanced Options", and finally "Command Prompt".

  3. Run diskpart and then list disk. Note the disk number for the disk with your EFI system partition (ESP).

  4. Select that disk with select disk x (where x is the disk number from the last step).

  5. Run list volume. Note the volume number for your EFI system partition (ESP).

  6. Now do select volume x (where x is the volume number for the ESP) and then assign letter=N: to mount the partition. Run list volume again and note that the ESP is now assigned a driver letter. Run exit to leave diskpart.

  7. (Optional) If you are not currently dual booting and want to fully clean the ESP before writing a new bootloader, run format N: /FS:FAT32 to reformat it as FAT32. This is probably not necessary under normal circumstances, however, as bcdboot seems to do a good job of cleaning things up itself. Especially do not do this if you have a Linux distro on another partition or else you'll have to reinstall GRUB as well once you're done with this. Also note that the following steps should not affect an EFI GRUB install as long as you do not otherwise delete GRUB's existing directory on the ESP.

  8. Finally, write the new bootloader to the partition with bcdboot C:\windows /s N: /f UEFI. This command rebuilds a new UEFI-compatible bootloader on the ESP mounted at N: using the Windows installation mounted at C:\windows. Once it's done, you can verify the new bootloader was written by running dir N:\EFI, where you should see a Microsoft directory containing the new Windows Boot Manager as well as a boot directory containing the fallback bootloader (along with other directories for any other bootloaders you have installed, such as GRUB for Linux).

  9. (Optional) If you are dual booting, you will probably need to boot into your Linux distro and run sudo update-grub to allow the GRUB scripts to detect and add the new Windows bootloader. You should also skip the next step and leave GRUB as your first boot choice so you can access both operating systems.

  10. Now boot into your BIOS setup and make sure "Windows Boot Manager" (or GRUB, if you're dual-booting) is set as the top boot choice. Save and reboot and you'll finally be back in Windows (or GRUB).

  1. Grab the Media Creation Tool, make yourself a Windows 10 installation DVD or USB drive, and then boot into it.

  2. When prompted, choose "Repair your computer", followed by "Troubleshoot", "Advanced Options", and finally "Command Prompt".

  3. Run diskpart and then list volume. Note the volume number for your EFI system partition (ESP).

  4. Now do select volume x (where x is the volume number for the ESP) and then assign letter=N: to mount the partition. Run list volume again and note that the ESP is now assigned a driver letter. Run exit to leave diskpart.

  5. (Optional) If you are not currently dual booting and want to fully clean the ESP before writing a new bootloader, run format N: /FS:FAT32 to reformat it as FAT32. This is probably not necessary under normal circumstances, however, as bcdboot seems to do a good job of cleaning things up itself. Especially do not do this if you have a Linux distro on another partition or else you'll have to reinstall GRUB as well once you're done with this. Also note that the following steps should not affect an EFI GRUB install as long as you do not otherwise delete GRUB's existing directory on the ESP.

  6. Finally, write the new bootloader to the partition with bcdboot C:\windows /s N: /f UEFI. This command rebuilds a new UEFI-compatible bootloader on the ESP mounted at N: using the Windows installation mounted at C:\windows. Once it's done, you can verify the new bootloader was written by running dir N:\EFI, where you should see a Microsoft directory containing the new Windows Boot Manager as well as a boot directory containing the fallback bootloader (along with other directories for any other bootloaders you have installed, such as GRUB for Linux).

  7. (Optional) If you are dual booting, you will probably need to boot into your Linux distro and run sudo update-grub to allow the GRUB scripts to detect and add the new Windows bootloader. You should also skip the next step and leave GRUB as your first boot choice so you can access both operating systems.

  8. Now boot into your BIOS setup and make sure "Windows Boot Manager" is set as the top boot choice. Save and reboot and you'll finally be back in Windows.

  1. Grab the Media Creation Tool, make yourself a Windows 10 installation DVD or USB drive, and then boot into it.

  2. When prompted, choose "Repair your computer", followed by "Troubleshoot", "Advanced Options", and finally "Command Prompt".

  3. Run diskpart and then list disk. Note the disk number for the disk with your EFI system partition (ESP).

  4. Select that disk with select disk x (where x is the disk number from the last step).

  5. Run list volume. Note the volume number for your EFI system partition (ESP).

  6. Now do select volume x (where x is the volume number for the ESP) and then assign letter=N: to mount the partition. Run list volume again and note that the ESP is now assigned a driver letter. Run exit to leave diskpart.

  7. (Optional) If you are not currently dual booting and want to fully clean the ESP before writing a new bootloader, run format N: /FS:FAT32 to reformat it as FAT32. This is probably not necessary under normal circumstances, however, as bcdboot seems to do a good job of cleaning things up itself. Especially do not do this if you have a Linux distro on another partition or else you'll have to reinstall GRUB as well once you're done with this. Also note that the following steps should not affect an EFI GRUB install as long as you do not otherwise delete GRUB's existing directory on the ESP.

  8. Finally, write the new bootloader to the partition with bcdboot C:\windows /s N: /f UEFI. This command rebuilds a new UEFI-compatible bootloader on the ESP mounted at N: using the Windows installation mounted at C:\windows. Once it's done, you can verify the new bootloader was written by running dir N:\EFI, where you should see a Microsoft directory containing the new Windows Boot Manager as well as a boot directory containing the fallback bootloader (along with other directories for any other bootloaders you have installed, such as GRUB for Linux).

  9. (Optional) If you are dual booting, you will probably need to boot into your Linux distro and run sudo update-grub to allow the GRUB scripts to detect and add the new Windows bootloader.

  10. Now boot into your BIOS setup and make sure "Windows Boot Manager" (or GRUB, if you're dual-booting) is set as the top boot choice. Save and reboot and you'll finally be back in Windows (or GRUB).

Source Link
Nathan2055
  • 1.3k
  • 3
  • 14
  • 30

The other answers given here work great on MBR/BIOS systems, however if you're on a UEFI system like I am, bootsect will just write a semi-functional boot MBR over the GPT protective MBR and bootrec just gives an "Access denied" error message, and neither one has a functional option to fix a broken EFI system partition, which on a UEFI/GPT drive is what contains the bootloader that used to be stored in the MBR. There's unfortunately almost no up-to-date guides on fixing the UEFI Windows Boot Manager (almost all of them just say to run the graphical Startup Repair utility, but that doesn't fix the problem in all cases), but I finally found the correct solution buried in this article, which requires the use of the bcdboot command instead:

  1. Grab the Media Creation Tool, make yourself a Windows 10 installation DVD or USB drive, and then boot into it.

  2. When prompted, choose "Repair your computer", followed by "Troubleshoot", "Advanced Options", and finally "Command Prompt".

  3. Run diskpart and then list volume. Note the volume number for your EFI system partition (ESP).

  4. Now do select volume x (where x is the volume number for the ESP) and then assign letter=N: to mount the partition. Run list volume again and note that the ESP is now assigned a driver letter. Run exit to leave diskpart.

  5. (Optional) If you are not currently dual booting and want to fully clean the ESP before writing a new bootloader, run format N: /FS:FAT32 to reformat it as FAT32. This is probably not necessary under normal circumstances, however, as bcdboot seems to do a good job of cleaning things up itself. Especially do not do this if you have a Linux distro on another partition or else you'll have to reinstall GRUB as well once you're done with this. Also note that the following steps should not affect an EFI GRUB install as long as you do not otherwise delete GRUB's existing directory on the ESP.

  6. Finally, write the new bootloader to the partition with bcdboot C:\windows /s N: /f UEFI. This command rebuilds a new UEFI-compatible bootloader on the ESP mounted at N: using the Windows installation mounted at C:\windows. Once it's done, you can verify the new bootloader was written by running dir N:\EFI, where you should see a Microsoft directory containing the new Windows Boot Manager as well as a boot directory containing the fallback bootloader (along with other directories for any other bootloaders you have installed, such as GRUB for Linux).

  7. (Optional) If you are dual booting, you will probably need to boot into your Linux distro and run sudo update-grub to allow the GRUB scripts to detect and add the new Windows bootloader. You should also skip the next step and leave GRUB as your first boot choice so you can access both operating systems.

  8. Now boot into your BIOS setup and make sure "Windows Boot Manager" is set as the top boot choice. Save and reboot and you'll finally be back in Windows.