• 使用BCDEDIT创建BCD文件


    网上找了好久,总算找到一个完全的BCD文件编辑过程的代码,分享下:

    ###第1步################################################################################################################
    bcdedit /createstore c:ootcd
    ##创建一个记录文件123 (路径和文件名随便啦)
    ###第2步###############################################################################################################
    bcdedit /store c:ootcd /create {bootmgr} /d "Windows Boot Manager"
    ##创建主菜单入口ID
    bcdedit /store c:ootcd /set {bootmgr} device partition=c:
    ##设置主菜单引导程序所在分区
    bcdedit /store c:ootcd /timeout 5
    ##设置主菜单的显示时间30秒
    bcdedit /store c:ootcd /set {bootmgr} locale "zh-CN"
    ##设置主菜单的语言为中文
    ###第3步#################################################################################################################
    bcdedit /store c:ootcd /create /d "Microsoft Windows Vista" /application osloader
    ##添加Vista启动项ID
    ###第4步#############这里会生成一串数字ID,复制第3步生成的数字ID并替换下面的{数字Id},如果你还装Win2008的话就再多做一个第3步和第4步#######
    bcdedit /store c:ootcd /set {数字Id} device partition=c:
    ##设置Vista引导文件所在分区
    bcdedit /store c:ootcd /set {数字Id} path windowssystem32winload.exe
    ##设置Vista引导文件路径
    bcdedit /store c:ootcd /set {数字Id} osdevice partition=c:
    
    ##设置Vista所在分区
    bcdedit /store c:ootcd /set {数字Id} systemroot windows
    ##设置Vista所在文件夹
    bcdedit /store c:ootcd /set {数字Id} locale "zh-CN"
    ##设置Vista高级启动菜单的语言为中文
    bcdedit /store c:ootcd /displayorder {数字Id} /addfirst
    ##添加Vista到主菜单启动列表的最后一项(addlast是显示在顶部)
    bcdedit /store c:ootcd /default {数字Id}
    ##设置Vista操作系统为默认启动的系统, {legacy}是旧版本的Windows
    ###第5步################################################################################################################
    bcdedit /store c:ootcd /create {ntldr} /d "Microsoft Windows XP Professional"
    ##添加xp,2003启动项ID
    bcdedit /store c:ootcd /set {ntldr} device partition=d:
    ##设置xp,2003引导文件所在分区
    bcdedit /store c:ootcd /set {ntldr} path 
    tldr
    ##设置xp,2003引导文件路径(98,me,xp,200,2003是用ntldr启动的)
    bcdedit /store c:ootcd /displayorder {ntldr} /addfirst
    ##添加xp,2003到主菜单启动列表的最后一项(addlast是显示在底部)
    ###第6步################################################################################################################
    bcdedit /store c:ootcd /create {memdiag} /d "Windows 内存诊侧"
    ##添加windows内存诊侧启动项ID
    bcdedit /store c:ootcd /set {memdiag} device partition=c:
    ##设置windows内存诊侧引导文件所在分区
    bcdedit /store c:ootcd /set {memdiag} path ootmemtest.exe
    ##设置windows内存诊侧启动程序文件路径
    bcdedit /store c:ootcd /toolsdisplayorder {memdiag} /addlast
    ##添加windows内存诊侧到主菜单工具列表的最后一项(addfirst是显示在顶部)
    bcdedit /store c:ootcd /set {memdiag} locale "zh-CN"
    ##设置windows内存诊侧的语言为中文
    ###第7步#################################################################################################################
    bcdedit /export c:456
    ##备份原有的系统引导记录到 c:456
    bcdedit /import c:ootcd
    ##记录文件信息导入到系统引导记录
    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                    windowssystem32winload.exe
    description             Microsoft Windows Vista
    locale                  zh-cn
    osdevice                partition=C:
    systemroot              windows
    
    Windows 内存测试程序
    ---------------------
    标识符                  {memdiag}
    device                  partition=C:
    path                    ootmemtest.exe
    description             Windows Memory Diag
    locale                  zh-cn
    
    Windows 旧 OS 加载器
    ------------------------
    标识符                  {ntldr}
    device                  partition=D:
    path                    
    tldr
    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

  • 相关阅读:
    C#制作windows屏保实战
    创建一个可以修改不可以删除的文件夹或文件,windows目录和文件权限实测总结
    分享一下我用C#写的贪吃蛇和迷宫
    用C#做的汉诺塔游戏以及对汉诺塔递归的简单理解
    纪念一下即将逝去的flash,曾今的flash入门学习示例《别盯着我》C#版
    C#中关于变量的作用域不易理解的特例
    列出文件夹和遍历文件夹的区别
    怎样创建无法直接删除的文件夹--关于windows权限的迷思
    用C#写的后台整点报时工具
    用C#写差异文件备份工具
  • 原文地址:https://www.cnblogs.com/feiquan/p/10646439.html
Copyright © 2020-2023  润新知