bcd - How to use BCDEdit to dual boot Windows installations?

07
2014-07
  • Ian Boyd

    What are the bcdedit commands necessary to setup dual boot between different installations of Windows?5

    Background

    I recently installed Windows 8 onto a separate hard drive1. Now that Windows 8 in installed I want to dual-boot back to Windows 7.

    I have my two2 hard drives:

    Windows partition manager screenshot

    So you can see that I have my two disks, with the partitions containing Windows:

    • Windows 7: \\PhysicalDisk0 (partition 03)
    • Windows 8: \\PhysicalDisk2 (partition 1)

    What I'm trying to figure out how is how to use bcdedit to instruct the thing that boots Windows that there is another Windows installation out there.

    Running bcdedit now, it shows current configuration:

    C:\WINDOWS\system32>bcdedit
    
    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    device                  partition=\Device\HarddiskVolume2
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    integrityservices       Enable
    default                 {current}
    resumeobject            {ce153eb7-3786-11e2-87c0-e740e123299f}
    displayorder            {current}
    toolsdisplayorder       {memdiag}
    timeout                 30
    
    Windows Boot Loader
    -------------------
    identifier              {current}
    device                  partition=C:
    path                    \WINDOWS\system32\winload.exe
    description             Windows 8
    locale                  en-US
    inherit                 {bootloadersettings}
    recoverysequence        {ce153eb9-3786-11e2-87c0-e740e123299f}
    integrityservices       Enable
    recoveryenabled         Yes
    allowedinmemorysettings 0x15000075
    osdevice                partition=C:
    systemroot              \WINDOWS
    resumeobject            {ce153eb7-3786-11e2-87c0-e740e123299f}
    nx                      OptIn
    bootmenupolicy          Standard
    hypervisorlaunchtype    Auto
    

    I cannot find any documentation on the difference between Windows Boot Manager and Windows Boot Loader.

    Documentation

    There is some documentation on Bcdedit:

    But they don't explain how to edit the binary boot configuration data.

    If I had to guess, I would think that a Windows Boot Manager instructs the BIOS what program it should run. That program would give the user a set of boot choices. That leaves Windows Boot Loader do be a particular boot choice, that represents a particular installation of Windows.

    If that is the case I would need to create a new Windows Boot Loader entry.

    This means I might want to use the /create parameter:

    /create

    Creates a new boot entry:

    bcdedit [/store filename] /create [id] /d description [/application apptype | /inherit [apptype] | /inherit DEVICE | /device]

    So I assume a syntax of:

    >bcdedit /create /d "The old Windows 7" /application osloader
    

    Where application can be one of the following types:

    Apptype     Description
    BOOTSECTOR  The boot sector application
    OSLOADER    The Windows boot loader
    RESUME      A resume application
    

    Unfortunately, the only documentation about osloader is "The Windows boot loader". I don't see how that can differentiate between Windows 8 on one hard drive, and Windows 7 on another.

    The other possible parameter when /create a boot loader is

    >bcdedit /create /D "Windows Vista" /device "The Quick Brown Fox"
    

    Unfortunately the documentation is missing for /device:

    /device

    Optional. If id is not set to a well-known identifier, the option that is used to specify the new boot entry as an additional device options entry.

    Since I did not set id to a well-known identifier, I must set /device to "the option that is used to specify the new boot entry as an additional device options entry". I know all those words; they're all English. But I have no idea what it is saying; those words in that order seem nonsensical.

    So I'm somewhat stymied. I don't want to be like Dan Stolts from Microsoft, who destroyed his hard drives trying to use BCDEdit:

    I found no content that was particularly helpful when I hosed my machine by playing with BCDEdit. This post would have been ok if there was much more detail especially on the /set command OSDevice, etc. So once I got my machine fixed, I documented the solution and the information is here....

    I mean, if a Microsoft guy can't even figure out how to use BCDEdit to edit his BCD, then what chance do I have?

    Bonus Reading

    Footnotes

    • 1 Since the Windows 8 installer would have damaged my Windows 7 install, I decided to unplug my "main" hard drive during the install. Which is a long-winded explanation of why the Windows 8 installer didn't detect the existing Windows 7 install. Normally the installer would have automatically created the required entries for dual-boot. Not that the reason I'm asking the question is important.
    • 2 Really there's three drives, but the third is just bulk storage. The existence of a 3rd hard drive is irrelevant to the question. I only mention it in case someone wants to know why the screenshot has 3 hard drives when I only mention two.
    • 3 I arbitrarily started numbering partitions at "zero"; not to imply that partitions are numbered starting at zero. I only mention partitions because I don't see how any boot-loader could do its job without knowing which partition, and which folder, an installation of Windows is located in.
    • 4 I'm asking about BCDEdit. I tried Visual BCD Editor. It seems to be a visual BCD editor. That is to say that it's a GUI, but still uses the same terminology as BCDEdit, and requires the same knowledge that BCD doesn't document.
    • 5 For simplicity sake we'll assume that all installation of Windows I want to dual-boot between are Windows Vista or later, making them all compatible with the BCDEdit and the binary boot loader. The alternative would require delving into the intricacies of the old ntloader. Nor am I asking about dual booting to Linux; or how to boot to a Virtual Hard Drive (vhd) image. Just modern versions of Windows on existing hard drives in the same machine.
  • Answers
  • snayob

    This is not a direct answer to the question before "Background" but points to an alternative solution for creating loader entries for booting two (and more) Windows Vista and later OS's. Please see also my second answer below about critic on terminology used in Visual BCD.

    No guids, devices, objects, elements and blah, blah, blah.

    My Background (skip if not interested and go to solution below):

    I have implemented Visual BCD Editor.

    During the implementation process I had to read all available sources on bcdedit and WMI BCD Provider interface (programming interface, can be used with C++, C#). The documentation from Microsoft is really poor.

    In the BCD there are objects (loaders, settings, device elements). There is no documentation about the connections between objects despite there are dependencies.

    There are more than 140 (!) elements (properties) of BCD objects in Windows 7. I do not know the meaning of some elements - there is simply no documentation.

    In Windows 8 there are new elements - I guess the total number now is approaching 180 (!!). No documentation.

    On the other hand there are two very powerful utilities for manipulating the BCD: bcdboot and reagentc.

    bcdboot - creates/fixes default loader also BCD and boot environment as a whole !

    reagentc - installs/deinstalls recovery environment (winre.wim)

    Both tools are not very well documented also.

    Alternative solution:

    There is almost no need of bcdedit as using only bcdboot you can create loaders for Windows Vista and later Windows OS's - you create loader for earliest OS, than for the latest and voila you have created the boot environment for a dual/multi boot system:

    Assuming you are in Windows 8:

    1. bcdboot f:\windows (this maps to Windows 7 as on picture in question)

    2. bcdboot c:\windows (this maps to Windows 8)

    Done !

    Base Microsoft rule for boot process: Boot environment (and BCD) should be always on [first disk + active partition]. (on picture - Disk 2 => First disk in BIOS boot sequence !)

    Last but not least there is the bootsect utility for writing MBR and PBR (master and partition boot record) - now standard in Windows 8 (was available only in WinRE earlier).

    So using only bootsect and bcdboot all boot entities for a dual boot system can be created/fixed.

    I think the boot process for Vista and later is described very well on many internet sites even on Microsoft.com.

    Note:

    One of the best sites about Windows BCD is Geoff Chappell's site - there is more detailed information there than on Microsoft.com. Interested users could find quite useful information there and some critical notes on bcdedit documentation.

  • Motorcycleboy

    When I formatted my C: drive to reinstall Windows the master boot record was deleted and the Windows 7 installer failed to restore it. I could use a GUI bcdedit tool like Visual BCD Edit tool, but why should I have to install something when there should be a simple command in the bcdedit consol program that can do the job? After much searching through the online help files I gave up with bcdedit and found the answer here buried in digressions. To create a boot entry for the second partition you have to use bcdboot

    Assuming you are in C:\Windows:

    1. bcdboot e:\windows

    2. bcdboot c:\windows

    When you reboot you will be presented with the Windows boot menu with two entries for Windows 7. If you select the entry that boots into C:\Windows you can rename the entry for this partition with:

    bcdedit /set {current} description "Windows 7 (Partition 1)"

    This makes the OS booted at startup the default entry in the boot menu:

    bcdedit /default {current}

    This places the default OS at startup first item in the boot menu

    bcdedit /displayorder {default} /addfirst

    Or you could make the OS at startup the first item in the boot menu:

    bcdedit /dispalyorder {current} /addfirst

    Now reboot and select the second item in the boot menu which should be labelled "Windows 7". Once booted into E:\Windows rename the OS booted at startup:

    bcdedit /set {current} description "Windows 7 (Partition 2)"

    Test that the boot menu works OK and save the bcd data to a partition that does not have an OS installed on it:

    bcdedit /export D:\Saved_BCD_Settings\SavedBCD

    If you mess up later you can restore the bcd boot menu with:

    bcdedit /import D:\Saved_BCD_Settings\SavedBCD

  • avirk

    You need a BCDEdit /set command for configure the boot volume. Then add the entry to the Windows Boot Manager operating system menu by calling the BCDEdit /displayorder command.

    bcdedit /set {ntldr} device boot

    It will identify the other OS' partition or the following command as well

    bcdedit /set {ntldr} device partition=C:

    The following line makes the entry bootable by adding it to the menu

    bcdedit /displayorder {ntldr} /addlast

    You can verify that the new entry will appear on the boot menu by running the command bcdedit /enum ACTIVE and looking for the Windows Legacy OS Loader entry.

    Note: /create command is used to ass non-Microsoft OS to boot loader entry.

    For more information regarding this you can read this source article


    Regarding your question about "Difference between Windows Boot loader and Boot manager"

    From wikipedia

    Windows NT startup process starts when the computer finds a Windows boot loader, a portion of Windows operating system responsible for finding Microsoft Windows and starting it up. On IA-32 or x64 systems, the boot loader is called Windows Boot Manager (BOOTMGR). Prior to Windows Vista however, the boot loader was NTLDR.

    See also on technet.


    Visual BCD Editor is an advanced GUI version of Windows bcdedit utility.

    It is the first GUI tool to implement full editing of Windows 7/Vista Boot Configuration Data (BCD) store.

    Download page for visual BCD editor.

    Give a try to repair option in the tool.

  • snayob

    Some notes on critic in original question about using same terminology in Visual BCD as Microsoft uses for bcdedit.

    The BCD concept is developed by Microsoft. It comes with its own terminology. I don't think I can change it. I can extend it only.

    Microsoft has given two ways for accessing/editing BCD:

    1. using bcdedit.exe - command line interface
    2. BCD WMI Provider interface - programmatic interface

    Both interfaces talk about BCD objects and elements. This is a general concept used as well in programming/computers as in other human areas. We could go even to philosophy which uses the terminology of objects, properties and relations for describing the world and the universe.

    BCD WMI provider access is more flexible as it gives a programmer the possibility to access every object and element in BCD and operate on them freely.

    Visual BCD makes full use of BCD WMI Provider Interface and implements access the same way as we are used to access Windows registry using regedit.exe. Moreover the tool automates two main tasks - creation of loaders and dual-boot repair. No other tool offers such one-click automatic functionality. I would say this is new terminology and new level of abstraction. I would not change the base Microsoft has created, I can only build on it.

    Novice users just click a button and a complex operation is carried out ! No background is needed ! You even do not have to know how many Windows versions you have installed - the tool tries to find them all and then create loaders for them if corresponding loaders are not already present in BCD - the terminology used - "Create missing Windows loaders" - I think everybody speaking English could understand/click/confirm such an operation or am I wrong ?

    The complexity of objects and elements in BCD is natural as the concept covers booting newer and older Windows OS as well as foreign OS like Linux, Unix etc. Moreover it is a general concept for MBR booting and EFI booting on a variety of devices.

    The most complex part of BCD is the device concept. You have partition device, ramdisk device, file device, locate device - you have to spend some time understanding it and I don't think this is for the normal Windows user. Forums are full with questions about disk partitions which is a far less complex topic. Many Windows users even don't know about the difference between primary and logical partition for example. You have to know about partitions if you want to dual/multi boot. You have to buy land if you want to build a second house.

    The BCD concept is the same since Vista - only new elements are defined in Windows 7/8.

    I think the registry structure for BCD is chosen as Windows implements this interface already and it is a reliable transactional interface proven to work over the years. If Windows registry concept in general is a good or a bad concept is another topic.

    It is up to the programmer/developer to create a more user friendly interface. I started with giving the same interface - a GUI equivalent of bcdedit - later the interface can be abstracted on a higher level based on usage patterns. A structured view of BCD is already implemented. This is the base abstraction layer.

    Next level of abstraction would be to concentrate on relations between objects as this topic is not covered by Microsoft. Not an easy task. New terminology comes with abstraction.

  • Mahmoud Al-Qudsi

    In response to the author's specific question as reiterated in the comments (although it does differ from his initial question regarding the bcdedit.exe sequences to accomplish the same):

    Perhaps almost something as simple as msconfig, except it lets you browse to another Windows install and it will add it for you.

    EasyBCD is exactly what you're looking for (free for personal use). It's a visual dual-boot manager tool for Windows, and adding a new Windows entry is with a point-and-click, exactly as you described it.

    There's a lot of resources on EasyBCD online, so I won't repeat everything here. Basically EasyBCD wraps up the complexity of bcdedit.exe and extends it with its own bootloader modules to let you set up dual-boots with other (newer or older) versions of Windows, as well as Linux, BSD, and more.

    Full disclosure: I'm the primary author of EasyBCD.


  • Related Question

    bcd - Has BCDEdit Changed between Vista and Windows 7?
  • Guy Thomas

    In Vista I got -displayorder to work with BCDEdit. But in Windows 7 I cannot change the display order. The only BCDEdit command that works for me is -timout.

    I have researched the topic, but the dearth of articles maybe a clue that something has changed between Vista and Windows 7.

    I have never seen strikethough used in Technet before, does this indicate that BCDEdit commands are no longer supported?

    http://technet.microsoft.com/en-us/library/cc709667(v=ws.10).aspx

    Incidentally I have got the job done with a 3rd party BCD editor, but I am curious as to how to get BCDEdit working in Windows 7 (and 8).

    Question 1: Has anything changed with BCDEdit (or is it just my error)

    Question 2: Can you recommend a good article on BCDEdit?


  • Related Answers
  • Andre Matias

    Probably you are using bcdedit with PowerShell. Try running the same command with cmd and see if that helps.