BCD and BCDEDIT commands : A breif Introduction

As the title says, This article is about BCD and BCDEDIT which explains the  basics of Boot Configuration Data (BCD) store and the BCD Editor (BCDEDIT.exe) tool which comes with Windows Vista and above.

BCD stands for Boot Configuration Data. Basically its replacement of traditional Boot.ini text file used to store boot configuration. The Boot process has been changed in windows vista and above. Now the Boot loader (bootmgr) does not longer looks for boot.ini text file instead refer the binary store “BCD” from boot directory of active partition.

 

 

 

Download

 

BCD is a binary file which holds the information about boot configuration like number of OS , Various boot parameters etc. As BCD is a binary file,we cannot edit the configuration file BCD with a text editor instead we have to use the inbuilt command line utility BCDEDIT.exe.

 

The Bcdedit.exe command-line tool modifies the boot configuration data store. The boot configuration data store contains boot configuration parameters and controls how the operating system is booted. These parameters were previously in the Boot.ini file (in BIOS-based operating systems) or in the nonvolatile RAM entries (in Extensible Firmware Interface-based operating systems). You can use Bcdedit.exe to add, delete, edit, and append entries in the boot configuration data store.

 

You can see all available command line options by typing BCDEDIT /? From CMD shell (Command Prompt)

So, if you can see all the options and description just by entering bcdedit /? then what’s the mean of writing this article ?

 

Well, this article explains the basics of Bcdedit and subsequent articles will explains the different uses of using this CLI to make changes which is very hard to figure out from the help menu and the inbuilt help does not explains if you have to manually add a complete entry what would be the complete steps…

 

[stextbox id="info"] Components of a BCD configuration [/stextbox]

There are three main elements in the boot configuration:

  1.  Store
  2.  Entries
  3.  Entry options.

 

Store and the BCD file both are same terms, Store contains Entries and Entry options control the Boot configuration. Below we are explaining each components in more details.

Store

A BCD store is the binary file which most often resides under boot directory (C:\boot)  of the active partition. It can be created , imported or exported. By default all commands operates on the default store located at boot directory until manually specified . While executing any BCDEDIT command you can manually specify the store path by providing /store parameters.

Example : To execute BCD commands on a store located at D:\ and file-name as temdbcd

 

[stextbox id="grey"]Bcdedit.exe /store D:\tempbcd[/stextbox]

 

Here are the commands which operates on a store

/createstore  -  Creates a new empty BCD store,

Example : BCDedit commands to create a new store in C:\temp

 

[stextbox id="grey"]bcdedit /createstore C:\temp\tempbcd [/stextbox]

 

/export – Exports the contents of the system store to a file which  can be used later to restore later.

Example : BCDEdit commands to export the current configuration to C:\temp\bcdbackup

 

[stextbox id="grey"]bcdedit /export C:\temp\BCDBackup[/stextbox]

 

/import – Restores BCD Configuration from  the backup file  created with the /export command.

Example : BCDEDIT commands to restore the configration from the file we exported earlier.

 

[stextbox id="grey"]bcdedit /import C:\temp\BCDBackup[/stextbox]

 

Entries :

Inside the store there are OS (Operating System) entries. Entries are the one we see at boot selection menu on start-up like Windows 7 / windows XP and anything else you might changed.  This Entry is same as we have in boot.ini. The difference is in BCD Each entry usually have a GUID. So, to make any changes, we will have to specify the GUID of that particular entry. By default the commands operates on default entry.

 

Below are the Commands that operate on entries in a store -

 

BCDEDIT /enum -  this will list out all the entries you have in your BCD Store. if not specified, It will fetch the details from default Store which is  C:\boot\bcd. It’s an importent command as we will be using it each time we make any changes to check whether it’s done or not.
Note : Bcdedit /unum and BCDedit both commands functions somehow same.

Example:  bcdedit commands to list out all the entries in the system store.

 

[stextbox id="grey"]bcdedit /enum [/stextbox]

 

BCDEDIT /enum

 

 

/copy – Makes copies of entries in the store. Using this parameter you can make a copy of the settings as a new entry. helpful when you just want modify 1 or 2 entries options in an entry like boot drive or something else.

Example : BCdedit commands to copy default entry as a new Entry name “test Entry”

[stextbox id="grey"]

C:Windowssystem32>bcdedit /copy {default} /d “testentry”

The entry was successfully copied to {25cb896f-3755-11e1-869e-b967442480f9}.

[/stextbox]

Note the Guid Genrated by above command, It means for the new entry “testEntry” we have a new GUID.

 

 

/create – Creates new entries in the store..Where /copy copies settings from an existing  entry the /Create command creates a new blank entry. You will have to enter some more commands in order to get the new entry to work.

Example: Create a new Entry named “test1″ which we will use to load another boot loader or OS.

 

[stextbox id="grey"]

C:Windowssystem32>bcdedit /create /d “test1? /application osloader

The entry {25cb8970-3755-11e1-869e-b967442480f9} was successfully created.

[/stextbox]

The output says a new entry has been created with a new GUID.

PS: to Make a new entry to work you have put more commands.

 

 

/delete – Deletes entries from the store.

Example : Bcdedit commands to delete an entry use below syntax.

[stextbox id="grey"]bcdedit /delete {25cb8970-3755-11e1-869e-b967442480f9}[/stextbox]

Where, GUID is the GUID of the entry you are trying to remove.

 

 

 

 

Entry options : Important point.

3rd and Important component is Entry options, Entry options are the settings which control the OS loader settings, Something smiler to Boot.ini switches. Recall from boot.ini,remember those /sos /3gb etc switches ? these are controlled from the entry options commands.

 

The most important part of configuration is entry options. It controls the startup like from where to look for the OS loader,the OS partition stuffs.

 

Commands that operate on entry options :

 

/deletevalue – Deletes entry options from the store.

Example : bcdedit commands to delete a value name NX from the default option.

[stextbox id="grey"]bcdedit /deletevalue nx [/stextbox]

The syntax is , Bcdedit /deletevalue <valuename>

 

 

/set – Sets entry option values in the store.

Although there is a wide range of parameters of /SET command but I would mentioned only few of them which are most important and use with most entries..

In below commands replace {ID} with the GUID generated by /copy or /create command line. Or if you want to modify the existing entries then use them standalone.If you ommit the ID then it will be applied on the default entry.

 

PS: If you created or added an OS entry manually using /create or /copy command  then these are the minimum you should apply for an entry.

 

[stextbox id="grey"]

BCDEDIT.EXE /SET {ID} path windows\system32\boot\winload.exe

BCDEDIT.EXE /SET {ID} device PARTITION=<drive>

BCDEDIT.EXE /SET {ID} osdevice Drive

BCDEDIT.EXE /SET {ID} systemroot windows

BCDEDIT.EXE /SET {ID} detecthal yes

BCDEDIT.EXE /SET {ID} nx optin

BCDEDIT.EXE -displayorder {572bcd55-ffa7-11d9-aae2-0007e994107d} -addlast

[/stextbox]

 

Here is the details of each of the options above :

/set {ID} path – it defined the osloader executable. Like in XP and windows 2003 based system ntldr was the OS loader.

/Set {ID} device – it defines the boot device from where windows will beloaded. Valid formats are :

BOOT

PARTITION=<drive>

HD_PARTITION=<drive>

FILE=[<parent>]<path>

RAMDISK=[<parent>]<path>,<optionsid>

VHD=[<parent>]<path>,<locatecustom>

/set {ID} osdevice is the drive from where windows will boot

/set {ID} systemroot – is the system root of windows, most of time these settings are kept default.do not change if you do  not know what are you going to do.

/Detacthal = ON or OF, It will forceful the computer to detect and load the correct HAL for the system so even if you change number of processor it wont effect the booting(Optional).

/displayorder = It sets the order of the entry in the boot menu at startup.

 

 

I think that’s should be enough for making changes as and when needed,  If you need something specific , feel free to ask below in the comment box and I will try to respond as soon as I can.

 

For your convenience, Below table will summarize what we have learned above.

 

Command Description
Commands that operate on a store
/createstore Creates a new empty BCD store.
/export Exports the contents of the system BCD store to a specified file.
/import Restores the state of the system BCD store from a specified file.
Commands that operate on boot entries in a store
/copy Makes copies of boot entries.
/create Creates new boot entries.
/delete Deletes boot entries.
Commands that operate on elements
/deletevalue Deletes elements from a boot entry.
/set Creates or modifies a boot entry’s elements.
Commands that control output
/enum Lists the boot entries in a store.
Commands that control Boot Manager
/bootsequence Specifies a one-time boot sequence.
/default Specifies the default boot entry.
/displayorder Specifies the order in which Boot Manager displays its menu.
/timeout Specifies the Boot Manager Timeout value.
/toolsdisplayorder Specifies the order in which Boot Manager displays the tools menu.
Commands that control Emergency Management Services
/bootems Enables or disables Emergency Management Services (EMS) for a specified boot application.
/ems Enables or disables EMS for an operating system boot entry.
/emssettings Specifies global EMS parameters.
Commands that control debugging
/bootdebug Enables or disables boot debugging for a boot application.
/dbgsettings Specifies global debugger parameters.
/debug Enables or disables kernel debugging for an operating system boot entry.
Commands that modify other commands
/store Specifies the BCD store upon which a command acts.
/v Displays boot entry identifiers in full, rather than using well-known identifiers.

Download
Hope you enjoyed this article , Feel free to drop a comment incase you have any questions or suggestions.

 

 

6 Comments

  1. I liked your article is an interesting technology
    thanks to google I found you

  2. Dipak

    Good piece of information..

  3. awesome blog, do you have twitter or facebook? i will bookmark this page thanks.

  4. lalit mohan

    nice one. vry helpful…

Leave a Reply