How to use the command line to troubleshoot problems with the boot record
The built-in Windows system restore allows you to correct most computer problems. However, very often the problems have to be solved by hand, such as when the operating system is not loaded. In these cases you can use a utility called Bootrec.exe. It can help in Troubleshooting and correcting data, such as the master boot record (MBR), boot sector, or boot configuration file (BCD).
Regardless of whether you are using Windows 7 or Windows 8.1, if your operating system won’t boot, but startup repair is unable to overcome this problem, you should try Bootrec.exe.
Working with this tool is via command prompt. However, since you have problems with the operating system, it is obvious that you will not be able to run Bootrec.exe directly in Windows.
If you have Windows 7, then you need to boot from the installation media or a system repair disc.
To boot from DVD or USB drive, the corresponding device should be first device in the section «First Boot Device» in the BIOS. Depending on motherboard manufacturer and BIOS version, this section might be named a little differently.
If the download process from the installation disk went well, select your preferred language and click «Next». In the next window click on «system Restore».
Then select the operating system you want to restore. This is an important step when you have multiple operating systems installed, but damaged only one. Click «Next» to continue.
In the opened window you will see the system recovery options, but in this case we are only interested in the command line.
If you do not have Windows 7 installation disc or a system repair disc, you can access the system recovery options by using a hidden recovery partition that Windows 7 creates automatically during installation of the operating system. About how to do it, read here under «How to start system restore using advanced boot options in Windows 7».
In that case, if you are using Windows 8 or Windows 8.1, follow the steps described in the third, fourth or fifth sections of this guide: «5 ways to boot Windows 8 and Windows 8.1 in safe mode». Depending on the chosen method to load your system, you can run the command line additional parameters, either from the safe mode interface.
Now that command prompt is running, enter the command bootrec.exe and press Enter to see all options available for this tool. As seen from the screenshot below, there are four options: /FixMbr, /FixBoot, /ScanOs and /RebuildBcd.
Later in this article I will explain how each of these parameters can help you solve boot problems. Bootrec.exe can help to solve most problems, but this does not guarantee success in all scenarios, so keep that in mind.
How to restore the Master Boot Record (MBR)
The first parameter Bootrec.exe is /FixMbr. It allows you to recover corrupted Master Boot Record (MBR). Master Boot Record is the first sector of the disk, and it tells the BIOS where to look for the operating system on your computer.
Typically, this parameter should be used in cases when you encounter one of these error messages: «Operating system not found» («Operating System not found»), «Error loading operating system» («Error loading operating system»), «Operating system missing» («Missing operating system») or «Invalid partition table» («Invalid partition table»).
To begin the process of restoring the MBR, run the command bootrec.exe /fixmbr.
How to write a new boot sector
Use the /FixBoot writes a new boot sector on the system partition. The tool will use the boot sector that is compatible with your version of Windows. Using this parameter can help in the following situations:
- the boot sector was replaced with a nonstandard Windows Vista, 7, 8 or 8.1 boot sector;
- the boot sector is damaged;
- after you install your operating system was running an earlier version of Windows.
To write a new boot sector, use the command bootrec.exe /fixboot.
How to restore the boot configuration data (BCD)
BCD (Boot Configuration Data, BCD) contain a detailed list of what has to load at system startup. Microsoft indicates that the load error can also be caused missing or damaged files in the BCD. The option /rebuildbcd can be very useful when you need to correct errors through full recovery BCD.
To completely rebuild Boot Configuration Data, run the following command: bootrec.exe /rebuildbcd.
How to add missing Windows installations to the boot configuration data
If your computer has multiple operating systems, but not all of them are available, use the option /ScanOS (team bootrec.exe /scanos) to bootrec.exe «scrubbed» all of the drives for the presence on them of any installed Windows versions that are not included in the boot configuration data (BCD).
In the screenshot below you can see this scanning.
If the command bootrec.exe /scanos returns the results, you will be able to continue the restore process to return a «lost» installation of Windows back to a safe table to the BCD, making it downloadable again.
Firstly, you should clean the Master Boot Record (MBR) by using bootrec /fixmbr. Then enter bootsect.exe /nt60 all /force and press Enter. Option /nt60 applies the master boot code that is compatible with BOOTMGR. Option /all updates the master boot code on all partitions. The parameter /force forcibly dismounts the volume(a) during the boot code update.
After you complete these commands, you will create a new master boot record (MBR), which will use the correct Windows boot loader to run this particular operating system from your disk.
If you have any questions, feel free to leave comments.