直接用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啟動菜單。)
利用Bcdedit建立Linux系統引導
使用Bootmgr 引導Ubuntu (非wubi安裝)
建立bootmgr對Ubuntu的引導