Examples - Part 1


The BCD Store used to boot the operating system may be in use as the system store - if a system store is in use then this will be the default store on which all bcdedit commands are carried out. If no system store is in use, or to specify a store other than the system store, the /store switch must be used.

I personally recommend using the /store switch whenever modifying a BCD store to reduce the risk of targeting the wrong store. To specify the BCD store D:\Boot\BCD we would use the command bcdedit.exe /store D:\Boot\BCD .....

Before modifying a BCD store I recommend that you create a backup. Be aware that modifying a BCD store could result in your system not booting, I therefore recommend that you take either of the following precautions -

All examples in this section use the same format - the commands as they would be entered at a command prompt followed by an example batch file automating these commands. All of these examples use the /store switch to specify BCD store C:\Boot\BCD. Don't forget to change the device/path when adapting these examples to your own system.

Create a new (empty) store

Create {bootmgr} entry

Create entry for Windows Vista/7

The following entry will add a menu option for either Windows Vista or 7 - don't forget to change the description entry.

Running this first command will return a Globally Unique IDentifier (GUID) value - e.g. {e05b4c23-618a-11df-89c6-001d925a73cf}. In all subsequent commands replace {guid} with this value -

These commands will boot Windows Vista/7 but will not add any advanced options such as resumeobject's or F8 Windows Recovery Environment.

Create {ntldr} entry

The {ntldr} option can be used to boot legacy operating systems including Windows 2000/XP/2003. This option is generally only used in dual or multiboot systems. The files boot.ini and ntdetect.com (from an existing Windows 2000/XP/2003) will need to be copied to the boot partition containing BOOTMGR and the BCD store.

Don't forget to change the device partition= to the drive containing your own Windows 2000/XP/2003 installation. Also change the description as required.

Create entry for VHD boot

At this time only Windows 7 (Ultimate and Enterprise) and Windows Server 2008 R2 can be booted from a VHD file. These commands will add an entry for an existing VHD installation. Edit the description and device path as required.

Running this first command will return a Globally Unique IDentifier (GUID) value - e.g. {e05b4c23-618a-11df-89c6-001d925a73cf}. In all subsequent commands replace {guid} with this value -

Create entry for Grub4dos

The following example uses device boot - this can be changed to device partition=#:. You will need to copy grldr.mbr to the device specified. You will then need to copy grldr and menu.lst to any supported partition (FAT/NTFS/EXT2/3).

Running this first command will return a Globally Unique IDentifier (GUID) value - e.g. {e05b4c23-618a-11df-89c6-001d925a73cf}. In all subsequent commands replace {guid} with this value -

Create {ramdiskoptions} entry

As far as I am aware {ramdiskoptions} is only used in order to boot a Windows Vista/2008/7 based WinPE. {ramdiskoptions} is used to identify the .sdi file required during the initial stages of booting WinPE.

Due to a bug any subsequent WinPE based objects do not display their own descriptions if a {ramdiskoptions} description has been set. Do not therefore specify any description for {ramdiskoptions} - thanks to boot-land forum member cdob for this tip (see here).

The following example uses device boot - this can be changed to device partition=#: if required. Edit the ramdisksdipath path as required.

Create entry for WinPE

A {ramdiskoptions} object must exist before creating an entry for WinPE. The following example uses device ramdisk=[boot] - this can be changed to device ramdisk=[#:] if required. Edit the description and device path as required.

Running this first command will return a Globally Unique IDentifier (GUID) value - e.g. {e05b4c23-618a-11df-89c6-001d925a73cf}. In all subsequent commands replace {guid} with this value -

Using multiple {ramdiskoptions}

Thanks to boot-land forum member cdob for this tip (see here).

Although only one {ramdiskoptions} object can be created it is possible to use a different .sdi file to the one specifed in {ramdiskoptions} ramdisksdipath by using the following workaround. At present I have not found any real use for implementing this however, as cdob points out, it may be necessary in future.

  1. bcdedit.exe /store C:\Boot\BCD /create /device

Running this first command will return a Globally Unique IDentifier (GUID) value - e.g. {e05b4c23-618a-11df-89c6-001d925a73cf}. In all subsequent commands replace {ramdisk_guid} with this value -

  1. bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdidevice partition=C:
  2. bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdipath \Boot\different.sdi

Now to use this to boot WinPE -

  1. bcdedit.exe /store C:\Boot\BCD /create /application osloader

Running this command will return a Globally Unique IDentifier (GUID) value - e.g. {bdaf610c-622d-11df-a7ee-a711d7fae90e}. In all subsequent commands replace {guid} with this value and replace {ramdisk_guid} with the GUID created by running the command in step 1 -

  1. bcdedit.exe /store C:\Boot\BCD /set {guid} systemroot \Windows
  2. bcdedit.exe /store C:\Boot\BCD /set {guid} detecthal Yes
  3. bcdedit.exe /store C:\Boot\BCD /set {guid} winpe Yes
  4. bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
  5. bcdedit.exe /store C:\Boot\BCD /set {guid} device ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
  6. bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows PE"
  7. bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast