使用BCDEDIT创建BCD文件


网上找了好久,总算找到一个完全的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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM