直接用bcdedit创建bootmgr数据库和修复启动菜单

直接用bcdedit创建bootmgr数据库和修复启动菜单

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


1、创建BCD数据库

将安装光盘上的boot文件夹和bootmgr文件一起复制到c盘,然后删除C:\Boot\bcd文件。配置 BCD 存储在此步骤中,使用 BCDEdit 新建名为 BCD 的启动配置文件。BCD 替换 Boot.ini。BCDEdit 是旨在管理 BCD 存储的命令行工具。Windows PE 和 Windows Vista 中都提供 BCDEdit。例如,进入bcdedit所在目录执行如下命令:

Bcdedit /createstore c:\BCD

bcdedit /import c:\bcd

Bcdedit /create {bootmgr} /d "Boot Manager"

Bcdedit /set {bootmgr} device boot

bcdedit /set {bootmgr} locale en-US //可以不设置,默认为英文


2、添加Windows XP启动菜单:

bcdedit /create {ntldr} /d " Windows XP Professional"

bcdedit /set {ntldr} path \ntldr

bcdedit /set {ntldr} device partition=c:

bcdedit /displayorder {ntldr} -addlast


3、添加Windows 7启动菜单

Bcdedit /create /d " Windows 7 Ultimate " -application osloader

这条命令完后会返回一个GUID值,如:{faef23c1-6efe-11de-b779-b2c7bec45a2c}

The entry {uid} was successfully created.

接下来{uid}这个GUID值就表示是Windows 7的菜单项。

Bcdedit /set {uid} osdevice partition=E:

Bcdedit /set {uid} device partition=E:

Bcdedit /set {uid} path \windows\system32\winload.exe

Bcdedit /set {uid} systemroot \windows

Bcdedit/displayorder {uid} -addlast


4、添加PE 1.0启动菜单

bcdedit /copy {ntldr} /d "Windows PE"

//The entry {uid} was successfully

bcdedit /set {uid} path \LDRXPE

bcdedit /set {uid} device partition=c:

bcdedit /displayorder {uid} -addlast


5、添加Ubuntu9.04启动菜单

下载grub4dos软件包,提取文件grldr 和grldr.mbr拷贝到C盘根目录

bcdedit /create /d "GRUB MENU" /application bootsector #建立一个名称为“GRUB MENU”,实模式启动扇区的启动项

生成{ID}复制下来

bcdedit /set {ID} device partition=c: #设置引导扇区文件所在的分区,grldr.mbr所在分区

bcdedit /set {ID} path \grldr.mbr #指定引导扇区文件的路径和文件名

bcdedit /displayorder {ID} /addlast #增加这个Ubuntu的菜单项到末尾。

下面修改menu.lst,就行了。

附:我的Ubuntu9.04 menu.lst

title      Ubuntu 9.04, kernel 2.6.28-12-generic

root      ()/ubuntu/disks

kernel    /boot/vmlinuz-2.6.28-12-generic root=UUID=2414A33A14A30DBC loop=/ubuntu/disks/root.disk ro quiet splash

initrd    /boot/initrd.img-2.6.28-12-generic


6、设置默认的启动条目和选择时间

Bcdedit /default {uid}

bcdedit /timeout 7


7、修改启动参数模式

bootsect /nt: (nt52是用ntldr方式启动,即XP启动菜单方式启动;nt60则是使用VISTA新式的bootmgr启动菜单。)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19036.html