How to use BCDEdit to dual boot Windows installations

bcdbcdedit

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.

Best Answer

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.

Related Question