網上找了好久,總算找到一個完全的BCD文件編輯過程的代碼,分享下:
###第1步################################################################################################################ bcdedit /createstore c:\boot\bcd ##創建一個記錄文件123 (路徑和文件名隨便啦) ###第2步############################################################################################################### bcdedit /store c:\boot\bcd /create {bootmgr} /d "Windows Boot Manager" ##創建主菜單入口ID bcdedit /store c:\boot\bcd /set {bootmgr} device partition=c: ##設置主菜單引導程序所在分區 bcdedit /store c:\boot\bcd /timeout 5 ##設置主菜單的顯示時間30秒 bcdedit /store c:\boot\bcd /set {bootmgr} locale "zh-CN" ##設置主菜單的語言為中文 ###第3步################################################################################################################# bcdedit /store c:\boot\bcd /create /d "Microsoft Windows Vista" /application osloader ##添加Vista啟動項ID ###第4步#############這里會生成一串數字ID,復制第3步生成的數字ID並替換下面的{數字Id},如果你還裝Win2008的話就再多做一個第3步和第4步####### bcdedit /store c:\boot\bcd /set {數字Id} device partition=c: ##設置Vista引導文件所在分區 bcdedit /store c:\boot\bcd /set {數字Id} path \windows\system32\winload.exe ##設置Vista引導文件路徑 bcdedit /store c:\boot\bcd /set {數字Id} osdevice partition=c: ##設置Vista所在分區 bcdedit /store c:\boot\bcd /set {數字Id} systemroot \windows ##設置Vista所在文件夾 bcdedit /store c:\boot\bcd /set {數字Id} locale "zh-CN" ##設置Vista高級啟動菜單的語言為中文 bcdedit /store c:\boot\bcd /displayorder {數字Id} /addfirst ##添加Vista到主菜單啟動列表的最后一項(addlast是顯示在頂部) bcdedit /store c:\boot\bcd /default {數字Id} ##設置Vista操作系統為默認啟動的系統, {legacy}是舊版本的Windows ###第5步################################################################################################################ bcdedit /store c:\boot\bcd /create {ntldr} /d "Microsoft Windows XP Professional" ##添加xp,2003啟動項ID bcdedit /store c:\boot\bcd /set {ntldr} device partition=d: ##設置xp,2003引導文件所在分區 bcdedit /store c:\boot\bcd /set {ntldr} path \ntldr ##設置xp,2003引導文件路徑(98,me,xp,200,2003是用ntldr啟動的) bcdedit /store c:\boot\bcd /displayorder {ntldr} /addfirst ##添加xp,2003到主菜單啟動列表的最后一項(addlast是顯示在底部) ###第6步################################################################################################################ bcdedit /store c:\boot\bcd /create {memdiag} /d "Windows 內存診側" ##添加windows內存診側啟動項ID bcdedit /store c:\boot\bcd /set {memdiag} device partition=c: ##設置windows內存診側引導文件所在分區 bcdedit /store c:\boot\bcd /set {memdiag} path \boot\memtest.exe ##設置windows內存診側啟動程序文件路徑 bcdedit /store c:\boot\bcd /toolsdisplayorder {memdiag} /addlast ##添加windows內存診側到主菜單工具列表的最后一項(addfirst是顯示在頂部) bcdedit /store c:\boot\bcd /set {memdiag} locale "zh-CN" ##設置windows內存診側的語言為中文 ###第7步################################################################################################################# bcdedit /export c:\456 ##備份原有的系統引導記錄到 c:\456 bcdedit /import c:\boot\bcd ##記錄文件信息導入到系統引導記錄 bcdedit /enum all ##察看系統引導記錄中的所有信息 ###OK完成了!!##############################################################################################################
創建完成后的效果:
Windows 啟動管理器 -------------------- 標識符 {bootmgr} device partition=C: description Windows Boot Manager locale zh-cn default {default} displayorder {default} {ntldr} toolsdisplayorder {memdiag} timeout 5 Windows 啟動加載器 ------------------- 標識符 {default} device partition=C: path \windows\system32\winload.exe description Microsoft Windows Vista locale zh-cn osdevice partition=C: systemroot \windows Windows 內存測試程序 --------------------- 標識符 {memdiag} device partition=C: path \boot\memtest.exe description Windows Memory Diag locale zh-cn Windows 舊 OS 加載器 ------------------------ 標識符 {ntldr} device partition=D: path \ntldr description Microsoft Windows XP
啟動入口最主要是四個部分:
Identifier標識符——啟動入口的系統標識,可能是bootmgr、current或id形式等。
device設備——一般是驅動器路徑或虛擬映像,系統啟動引導后入口。
path路徑——是device設備的位置,系統用來定位啟動文件。
description描述——顯示描述,也就是大家見到的菜單顯示。
{bootmgr} ——啟動管理器
{current}——當前操作系統,啟動時選擇的系統
{default} ——缺省默認的啟動項
{ntldr} ——早期Windows加載
轉自:https://www.cnblogs.com/fatt/p/4397615.html