使用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

posted @ 2019-04-03 00:56  feiquan  阅读(5386)  评论(0编辑  收藏  举报
如果是此文是转载文章,本人会附上转载链接,此篇文章的版权归原创作者所属,如果侵权请与我联系,我会删除此文。

若没有标明转载链接,此篇文章属于本人的原创文章,其版权所属:
作者:feiquan
出处:http://www.cnblogs.com/feiquan/
版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
大家写文都不容易,请尊重劳动成果~ 这里谢谢大家啦(*/ω\*)