用bcdedit.exe重建bcd

使用下面方法之前需要bcdedit.exe和bootsect.exe两个文件,bootsect.exe文件在vista和windows 7的安装光盘的boot目录下,而bcdedit.exe文件可以在安装了vista系统或者windows 7系统的电脑上的windowssystem32目录下获得,当然也可以使用imagex命令挂载vista或者windows 7安装光盘里sourceinstall.wim文件,然后到windowssystem32下也能找到bcdedit命令。至于imagex命令可以到微软官方下载WAIK工具包。

有3个入口(Entry),每个入口又有细分,最关键的是Identifier,在BCD中,每个入口的唯一标识就是这个Identifier(简称Id)。
共有个三个Id:
{bootmgr}
{ntldr}
{}

关于“/store”参数:
C:>bcdedit /store c:cdwolf /create {ntldr} /d "XP"
说明:如果在bcdedit后面不加这个store参数,则是对系统bcd进行操作;加了则是对指定的文件bcd进行操作。

1、创建BCD数据库
将安装光盘上的boot文件夹和bootmgr文件一起复制到c盘,然后删除C:Bootcd文件。
   进入bcdedit所在目录执行如下命令:
Bcdedit /createstore c:BCD    //由于我们还没有一个文件bcd,因此我们先创建一个
bcdedit /import c:cd    //将c:cd还原到系统(即:c:oot),备份为/export
Bcdedit /create {bootmgr} /d "Boot Manager"   //创建{bootmgr}入口,这个是主入口,不是菜单,建立的所有菜单都在这个入口中管理
Bcdedit /set {bootmgr} device boot 
bcdedit /set {bootmgr} locale en-US    //可以不设置,默认为英文 (这一段参考了WAIK帮助文档)

2、添加Windows XP启动菜单:
bcdedit /create {ntldr} /d "1. Windows XP Professional"    //创建菜单“1. Windows XP Professional”
bcdedit /set {ntldr} path tldr   //设置{ntldr}入口的path值,这里指定引导程序所在路径,xp是在c: tldr
bcdedit /set {ntldr} device partition=c:    //设置{ntldr}入口的device值,这里实际是xp所在分区,它在c盘
bcdedit /displayorder {ntldr} -addlast   //将id为{ntldr}的菜单追加到多重菜单的最后

3、添加Windows 7启动菜单
Bcdedit /create /d "2. Windows Seven Ultimate Build 7057" -application osloader    //创建菜单
这条命令完后会返回一个GUID值,如:
The entry {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} was successfully created.
接下来{631fdc40-1b9a-11de-aa5e-0010c6ff6db9}这个GUID值就表示是Windows 7的菜单项。
Bcdedit /set {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} osdevice partition=E:    //设置{}的windows device为E盘
Bcdedit /set {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} device partition=E:    //设置{}入口的device值
Bcdedit /set {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} path windowssystem32winload.exe   //设置{}入口的path值
Bcdedit /set {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} systemroot windows    //设置{}的windows root为windows
Bcdedit/displayorder {631fdc40-1b9a-11de-aa5e-0010c6ff6db9} -addlast    //将id为{}的菜单追加到多重菜单的最后

4、添加PE 1.0启动菜单
bcdedit /copy {ntldr} /d "3. Windows Preinstallation Enviroment 1.0"
//The entry {fcc0bdf0-1ba0-11de-aa5e-0010c6ff6db9} was successfully
bcdedit /set {fcc0bdf0-1ba0-11de-aa5e-0010c6ff6db9} path LDRXPE
bcdedit /set {fcc0bdf0-1ba0-11de-aa5e-0010c6ff6db9} device partition=c:
bcdedit /displayorder {fcc0bdf0-1ba0-11de-aa5e-0010c6ff6db9} -addlast

5、设置默认的启动条目和选择时间
Bcdedit /default {631fdc40-1b9a-11de-aa5e-0010c6ff6db9}
bcdedit /timeout 7

6、修改启动参数模式
bootsect /nt60 c:

原文地址:https://www.cnblogs.com/huhu0013/p/3553679.html