您可以使用系统恢复(system recovery)工具来修复大多数计算机问题。但是,有时您需要以手动方式解决此类问题,例如,当您的Windows 计算机(Windows computer)无法启动时。在这些情况下,您可以使用名为Bootrec.exe的工具。它可以帮助您排除和修复主引导记录(master boot record)( MBR )、引导扇区(boot sector)或引导配置数据 (BCD)(Boot Configuration Data (BCD))存储等内容。在所有现代版本的 Windows 中,它的工作原理如下:
注意:(NOTE:)本指南涵盖Windows 10、Windows 7 和Windows 8.1。
Bootrec.exe - Windows启动问题的终极修复工具(repair tool)
无论您使用的是 Windows 7 还是Windows 10,如果您的操作系统无法(operating system)启动并且启动修复(trouble booting and Startup Repair)无法解决问题,则值得尝试使用Bootrec.exe工具。使用此工具,您可以修复主引导记录 (MBR)(Master Boot Record (MBR))、写入新引导扇区(boot sector)、重建引导配置数据 (BCD)(Boot Configuration Data (BCD))并将丢失的Windows安装添加到引导配置(boot configuration)数据中。
如果您需要知道所有这些意味着什么,以下是对它们中的每一个的解释:
- 主引导记录 (MBR) -(Master Boot Record (MBR))系统驱动器(system drive)的第一个扇区。其目的是告诉计算机的BIOS到哪里寻找操作系统(operating system),以便它可以启动它。
- 引导扇区(Boot sector)- 包含要加载到RAM 内存中的代码的磁盘区域,这是加载(RAM memory)操作系统(operating system)所必需的。引导扇区(boot sector)必须具有特定的磁盘签名(disk signature)才能被BIOS视为引导扇区(boot sector)。如果此签名已损坏或已更改,BIOS将无法找到引导扇区(boot sector),也无法加载查找和启动操作系统(operating system)所需的指令。在Windows 7和更新版本的Windows中,引导扇区(boot sector)加载Windows 引导管理器(Windows Boot Manager),访问引导配置数据(Boot Configuration Data)并使用此信息加载操作系统(operating system)
- 引导配置数据 (BCD)(Boot Configuration Data (BCD)) - BCD是Windows 引导管理器(Windows Boot Manager)使用的引导时配置数据数据库。引导配置数据(Boot Configuration Data)存储在与Windows 注册表(Windows Registry)具有相同格式的数据文件(data file)中。
Windows无法成功加载时如何启动命令提示符(Command Prompt)
为了能够使用Bootrec.exe,您必须使用Command Prompt。但是,由于您已经遇到启动问题,很明显您将无法简单地从Windows运行它。
您需要使用在正常工作的Windows 计算机(Windows computer)上创建的修复光盘(repair disc)或恢复驱动器(recovery drive)。以下是一些可帮助您创建此类光盘/驱动器的指南:
- 什么是系统修复光盘(system repair disc)以及如何在Windows中创建一个- 本指南适用于所有现代版本的Windows。Windows 7 用户只有在想有机会修复计算机时才能使用此方法。修复光盘(repair disc)可以是CD 或 DVD(CD or DVD) ,其中包含对系统进行故障排除所需的所有文件
- 如何在Windows 10中创建(Windows 10)恢复驱动器(recovery drive)- 了解如何使用适用于Windows 10的恢复工具创建可启动USB 记忆(USB memory)棒。
- 如何在Windows 8和 8.1 中的USB 记忆(USB memory)棒上创建恢复驱动器(recovery drive)- 本指南仅对Windows 8用户有用。
创建recovery drive/disc后,从它启动。为此,请将其插入并启动您的Windows 计算机或设备(Windows computer or device)。启动后,立即按键盘上的启动设备选择键(boot device selection key)。通常是F12、F11或Escape 键(Escape key),但也可能是另一个,具体取决于设备主板的制造商。这样做将使您的计算机显示启动优先级选择菜单(boot priority selection menu)。使用键盘上的箭头键(arrow keys)选择恢复驱动器(recovery drive)。然后,按Enter,当系统要求按任意键从该驱动器启动时,请执行此操作。
如果您使用的是Windows 10或Windows 8.1,一旦您的PC(PC boots)从USB 驱动器(USB drive)启动,系统将要求您选择要使用的键盘布局。(keyboard layout)发生这种情况时,单击或点击(click or tap)与您的键盘匹配的布局。要在所有可用的键盘布局(keyboard layout)之间导航,请按“查看更多键盘布局”("See more keyboard layouts")。
可用的键盘语言列表很长,您可能需要滚动很多次才能找到要使用的布局。在下一个屏幕上,您应该单击或点击疑难解答(重置您的 PC 或查看高级选项)(Troubleshoot (Reset your PC or see advanced options))。
在高级选项(Advanced options)屏幕上,单击或点击命令提示符(Command Prompt)。
如果您使用的是Windows 7,首先,选择您要使用的键盘输入法,然后单击(keyboard input method)下一步(Next)。
然后,它会扫描可用的Windows安装并列出找到的那些。选择要修复的Windows 7安装,然后单击(Windows 7)下一步(Next)。
然后,当可用系统恢复选项(System Recovery Options)列表共享时,单击命令提示符(Command Prompt)。
启动命令提示符(Command Prompt)后,键入命令bootrec.exe并按Enter以查看可用于此工具的选项。正如您在下面的屏幕截图中看到的,有四个可用参数:/FixMbr, /FixBoot, /ScanOs和/RebuildBcd。
让我们看看它们如何帮助您解决计算机的启动问题。但请记住,即使Bootrec.exe工具可以处理大多数启动问题,它也不能保证在所有可能的情况下都能成功。
如何修复主引导记录(Master Boot Record)( MBR )
Bootrec.exe工具的第一个参数是/FixMbr。它允许修复损坏或损坏的主引导记录 (MBR)(Master Boot Record (MBR))。通常,当您遇到以下错误消息之一时,您将使用此参数:“找不到操作系统”("Operating System not found")、“加载操作系统时出错”("Error loading operating system")、“缺少操作系统”("Missing operating system")或“分区表无效”("Invalid partition table")。要启动MBR的(MBR)修复过程(repair process),请运行命令:bootrec.exe /fixmbr。
如何写一个新的引导扇区
/FixBoot参数将新的引导扇区(boot sector)写入系统分区(system partition)。该工具将使用与您的Windows 版本(Windows version)兼容的引导扇区(boot sector)。在以下情况下使用此参数很有用:
- 引导扇区(boot sector)已替换为非标准的Windows引导(Windows boot)扇区;
- 引导扇区损坏;
- 安装您的Windows(Windows)版本后,已安装较早的Windows 操作系统(operating system)。
要开始写入新的引导扇区(boot sector),请使用以下命令:bootrec.exe /fixboot。
如何重建引导配置数据(Boot Configuration Data)( BCD )
引导配置数据 (BCD)(Boot Configuration Data (BCD))包含启动时应该加载的详细列表。Microsoft指出,BCD中的文件丢失或损坏也可能导致启动错误(boot error)。当您必须通过完全重建BCD来修复某些错误时, (BCD)/rebuildbcd参数会非常有用。要完全重建引导配置数据(Boot Configuration Data),请运行以下命令:bootrec.exe /rebuildbcd。
如何将缺少的Windows安装添加到引导配置数据(Boot Configuration Data)
如果您的计算机安装了多个操作系统,但并非所有操作系统都可用,请使用/ScanOS选项。在Bootrec.exe(Bootrec.exe)上使用此参数将在所有磁盘上启动扫描,以查找当前未包含在引导配置数据 (BCD)中的任何(Boot Configuration Data (BCD))Windows安装。在下面的屏幕截图中,您可以看到此扫描过程的外观。
如果bootrec.exe /scanos命令返回结果,您将能够继续修复过程(repair process)。最后,您会将丢失的Windows 安装(Windows installation)恢复到安全的BCD 表中(BCD table),从而使其再次可启动。
首先(First),您必须使用bootrec /fixmbr主引导记录 (MBR)(Master Boot Record (MBR))。接下来,键入bootsect.exe /nt60 all /force并按Enter。/nt60 参数应用与BOOTMGR兼容的主引导代码(master boot code)。/all参数更新所有分区上的主引导代码(master boot code)。/force parameter引导代码更新(boot code update)期间强制卸载卷,以便Bootsect.exe工具(Bootsect.exe)不会获得独占卷访问权限(volume access)。
运行所有这些命令将创建一个新的MBR,并告诉它使用正确的Windows 引导(Windows boot)加载程序,以便从驱动器加载特定的安装。
结论
从本指南中可以看出,Bootrec.exe是一个非常强大的工具,用于对(Bootrec.exe)Windows 计算机(Windows computer)的启动记录进行故障排除和修复问题。如果您知道解决引导记录问题的其他方法,请随时在评论中分享。
How to use the Command Prompt to fix issues with your PC's boot records
You can use system recovery tools to fix most of your computer problems. However, there are times when уou'll need to addresѕ such issues in а manual way, like, for example, when your Windows computer wоn't boot. Іn 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.
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".
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).
On the Advanced options screen, click or tap on Command Prompt.
If you are using Windows 7, first, select the keyboard input method that you want to use and click Next.
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.
Then, when the list of available System Recovery Options are shared, click Command Prompt.
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.
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.
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.
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.
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.
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.
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.
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.