— iIT-Services

Use the Command Prompt to fix issues with your PC’s boot records

In case, during your partition resizing, your Windows installation turns sour (e.g., when installing multi boot such as with Bootcamp on a Mac), the follwing tutorial might serve the purpose: https://www.digitalcitizen.life/command-prompt-fix-issues-your-boot-records.

Especially the Bootrec.exe does a good job in the case of a “Missing operating system”.


Tutorial by Ciprian Adrian Rusen published on 02/02/2017

Command Prompt

You can use system recovery tools to fix most of your computer problems. However, there are times when you’ll need to address such issues in a manual way, like, for example, when your Windows computer won’t boot. In these cases, you can use a tool named Bootrec.exe. It can help you troubleshoot and repair things like the master boot record (MBR), the boot sector or the Boot Configuration Data (BCD) store. Here’s how it works, in all modern versions of Windows:

NOTE: This guide covers Windows 10, Windows 7 and Windows 8.1.

Bootrec.exe – The ultimate repair tool for boot problems in Windows

No matter whether you use Windows 7 or Windows 10, if your operating system has trouble booting and Startup Repair can’t fix the problem, it’s worth trying the Bootrec.exe tool. With this tool you can repair the Master Boot Record (MBR), write a new boot sector, rebuild the Boot Configuration Data (BCD) and add missing Windows installations to the boot configuration data.

If you need to know what all these mean, here’s an explanation for each of them:

  • Master Boot Record (MBR) – the first sector of your system drive. Its purpose is to tell the computer’s BIOS where to look for the operating system, so that it can start it.
  • Boot sector – the region of the disk that contains the code to be loaded into the RAM memory, that is necessary to load the operating system. A boot sector must have a specific disk signature to be seen by BIOS as a boot sector. If this signature is corrupted, or has been changed, the BIOS will not be able to find the boot sector and won’t be able to load the necessary instructions for finding and starting the operating system. In Windows 7 and newever versions of Windows, the boot sector loads the Windows Boot Manager, accesses the Boot Configuration Data and uses this information to load the operating system
  • Boot Configuration Data (BCD) – The BCD is a database of boot-time configuration data that is used by the Windows Boot Manager. The Boot Configuration Data is stored in a data file that has the same format as the Windows Registry.

How to start the Command Prompt when Windows won’t load successfully

In order to be able to use Bootrec.exe, you’ll have to use Command Prompt. However, because you already have startup issues, it’s obvious that you won’t be able to simply run it from Windows.

You need to use a repair disc or a recovery drive that was created on a working Windows computer. Here are some guides that will help you create such discs/drives:

Once you have recovery drive/disc created, boot from it. In order to do that, plug it in and start your Windows computer or device. Immediately after it starts, press the boot device selection key on your keyboard. It’s usually the F12, F11 or the Escape key, but it could be another as well, depending on the manufacturer of your device’s mainboard. Doing that will make your computer display a boot priority selection menu. Use the arrow keys on the keyboard to select the recovery drive. Then, press Enter and, when asked to press any key to boot from that drive, do so.

Command Prompt, boot, issues, Bootrec.exe

If you are using Windows 10 or Windows 8.1, once your PC boots from the USB drive, you will be asked to choose the keyboard layout that you want to use. When this happens, click or tap on the layout that matches your keyboard. To navigate between all the available keyboard layouts, press “See more keyboard layouts”.

Command Prompt, boot, issues, Bootrec.exe

The list of available keyboard languages is quite long and you may have to scroll a lot until you find the layout that you want to use. On the next screen, you should click or tap on Troubleshoot (Reset your PC or see advanced options).

Command Prompt, boot, issues, Bootrec.exe

On the Advanced options screen, click or tap on Command Prompt.

Command Prompt, boot, issues, Bootrec.exe

If you are using Windows 7, first, select the keyboard input method that you want to use and click Next.

Command Prompt, boot, issues, Bootrec.exe

Then, it scans for available Windows installations and lists those that are found. Select the Windows 7 installation that you want to repair and click Next.

Command Prompt, boot, issues, Bootrec.exe

Then, when the list of available System Recovery Options are shared, click Command Prompt.

Command Prompt, boot, issues, Bootrec.exe

Once you’ve launched the Command Prompt, type the command bootrec.exe and hit Enter to see the options that are available for this tool. As you can see in the screenshot below, there are four parameters available: /FixMbr, /FixBoot, /ScanOs and /RebuildBcd.

Command Prompt, boot, issues, Bootrec.exe

Let’s see how each of them can help you solve your computer’s boot problems. Keep in mind though, that even if the Bootrec.exe tool can handle most boot problems, it does not guarantee success in every possible situation.

How to repair the Master Boot Record (MBR)

The first parameter of the Bootrec.exe tool is /FixMbr. It allows the repair of a corrupted or damaged Master Boot Record (MBR). Usually, you will use this parameter when you are faced with one of these error messages: “Operating System not found”, “Error loading operating system”, “Missing operating system” or “Invalid partition table”. To start the repair process of the MBR, run the command: bootrec.exe /fixmbr.

Command Prompt, boot, issues, Bootrec.exe

How to write a new boot sector

The /FixBoot parameter writes a new boot sector to the system partition. The tool will use a boot sector that is compatible with your Windows version. Using this parameter is useful in the following situations:

  • The boot sector has been replaced with a non-standard Windows boot sector;
  • The boot sector is damaged;
  • An earlier Windows operating system has been installed after your version of Windows was installed.

To start writing a new boot sector, use this command: bootrec.exe /fixboot.

Command Prompt, boot, issues, Bootrec.exe

How to rebuild the Boot Configuration Data (BCD)

The Boot Configuration Data (BCD) contains a detailed list of what is supposed to load at startup. Microsoft indicates that a boot error can also be caused by missing or damaged files in the BCD. The /rebuildbcd parameter can be very useful when you must fix some errors by completely rebuilding the BCD. To completely rebuild the Boot Configuration Data, run this command: bootrec.exe /rebuildbcd.

Command Prompt, boot, issues, Bootrec.exe

How to add missing Windows installations to the Boot Configuration Data

If your computer has multiple operating systems installed but not all of them are available, use the /ScanOS option. Using this parameter on Bootrec.exe will launch a scan on all disks for any Windows installations that are not currently included in the Boot Configuration Data (BCD). In the screenshot below, you can see how this scan process might look.

Command Prompt, boot, issues, Bootrec.exe

If the bootrec.exe /scanos command returns results, you will be able to continue the repair process. In the end, you will get the lost Windows installation back into the secure BCD table, thus making it bootable again.

Command Prompt, boot, issues, Bootrec.exe

First of all, you have to clean the Master Boot Record (MBR) by using bootrec /fixmbr. Next, type bootsect.exe /nt60 all /force and press Enter. The /nt60 parameter applies the master boot code that is compatible with BOOTMGR. The /all argument updates the master boot code on all partitions. The /force parameter forcibly dismounts the volume(s) during the boot code update so that the Bootsect.exe tool does not gain exclusive volume access.

Command Prompt, boot, issues, Bootrec.exe

Running all these commands will create a new MBR and tell it to use the correct Windows boot loader in order to load that specific installation from your drive.

Conclusion

As you can from this guide, Bootrec.exe is a very powerful tool for troubleshooting and fixing problems with your Windows computer’s boot records. If you know other ways to fix issues with your boot records, don’t hesitate to share them in a comment.