The BCD Editor is an advanced command-line
tool for viewing and manipulating the configuration of the pre–operating
system boot environment. Although I discuss tasks related to modifying
the BCD data store in the sections that follow, you should attempt to
modify the BCD store only if you are an experienced IT pro. As a
safeguard, you should make a full backup of the computer prior to making
any changes to the BCD store. Why? If you make a mistake, your computer
might end up in a nonbootable state, and you would then need to
initiate recovery.
Computers can have system and nonsystem BCD stores. The system BCD
store contains the operating system boot entries and related boot
settings. Whenever you work with the BCD Editor, you work with the
system BCD store.
On a computer with only one operating system, the BCD entries for your computer will look similar to those in Example 1.
As the listing shows, the BCD store for this computer has two entries:
one for the Windows Boot Manager, and one for the Windows Boot Loader.
Here, the Windows Boot Manager calls the boot loader, and the boot
loader uses Winload.exe to boot Windows 8.
Example 1. Entries in the BCD Store on a Single-Boot Computer
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume1
description Windows Boot Manager
locale en-US
inherit {globalsettings}
integrityservices Enable
default {current}
resumeobject {16b857b4-9e02-11e0-9c17-b7d085eb0682}
displayorder {current}
{16b857ad-9e02-11e0-9c17-b7d085eb0682}
toolsdisplayorder {memdiag}
timeout 30
custom:26000025 Yes
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows 8
locale en-US
inherit {bootloadersettings}
recoverysequence {16b857b6-9e02-11e0-9c17-b7d085eb0682}
integrityservices Enable
recoveryenabled Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {16b857b4-9e02-11e0-9c17-b7d085eb0682}
nx OptIn
bootmenupolicy Standard
BCD entries for Windows Boot Manager and Windows Boot Loader have
similar properties. These properties include those summarized in Table 1.
Table 1. BCD Entry Properties
PROPERTY |
DESCRIPTION |
---|
Description |
Shows descriptive information to help identify the type of entry. |
Device |
Shows the physical device path. For a partition on a physical disk, you’ll see an entry such as partition=C:. |
FileDevice |
Shows the path to a file device, such as partition=C:. |
FilePath |
Shows the file path to a necessary file, such as \Hiberfil.sys. |
Identifier |
Shows a descriptor for the entry. This can be a boot loader
application type, such as Bootmgr or Ntldr, a reference to the current
operating system entry, or the globally unique identifier (GUID) of a
specific object. |
Inherit |
Shows the list of entries to be inherited. |
Locale |
Shows the computer’s locale setting, such as en-US. The locale
setting determines the language shown in the user interface (UI). The
\Boot folder contains locale subfolders for each locale supported, and
each of these subfolders have language-specific UI details for the
Windows Boot Manager and the Windows Memory Diagnostic utility
(Memdiag.exe). |
Osdevice |
Shows the path to the operating system device, such as partition=C:. |
Path |
Shows the actual file path to the boot loader application, such as \Windows\System32\Winload.exe. |
When you are working with the BCD store and the BCD Editor, you’ll see references to well-known identifiers, summarized in Table 2, as well as GUIDs. When a GUID is used, it has the following format, where each N represents a hexadecimal value:
{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN}
such as:
{16b857ad-9e02-11e0-9c17-b7d085eb0682}
The dashes that separate the parts of the GUID must be entered in the
positions shown. Both well-known identifiers and GUIDs are enclosed in
braces.
Table 2. Well-Known Identifiers
IDENTIFIER |
DESCRIPTION |
---|
{badmemory} |
Contains the global RAM defect list that can be inherited by any boot application entry. |
{bootloadersettings} |
Contains the collection of global settings that should be inherited by all Windows Boot Loader application entries. |
{bootmgr} |
Indicates the Windows Boot Manager entry. |
{current} |
Represents a virtual identifier that corresponds to the operating
system boot entry for the operating system that is currently running. |
{dbgsettings} |
Contains the global debugger settings that can be inherited by any boot application entry. |
{default} |
Represents a virtual identifier that corresponds to the boot manager default application entry. |
{emssettings} |
Contains the global EMS settings that can be inherited by any boot application entry. |
{fwbootmgr} |
Indicates the firmware boot manager entry. This entry is used on EFI systems. |
{globalsettings} |
Contains the collection of global settings that should be inherited by all boot application entries. |
{hypervisorsettings} |
Contains the hypervisor settings that can be inherited by any operating system loader entry. |
{memdiag} |
Indicates the memory diagnostic application entry. |
{ntldr} |
Indicates the Windows Legacy OS Loader (Ntldr) that can be used to
start Windows operating systems earlier than Windows Vista. Used when
you’ve installed a legacy operating system. |
{ramdiskoptions} |
Contains the additional options required by the boot manager for RAM disk devices. |
{resumeloadersettings} |
Contains the collection of global settings that should be inherited by all Windows resume-from-hibernation application entries. |
When a computer has additional instances of Windows Vista or later installed, the BCD
store has additional entries for each additional operating system. For
example, the BCD store might have one entry for the Windows Boot Manager
and one Windows Boot Loader entry for each operating system.
When a computer has a legacy operating system installed, such as
Windows XP, the BCD store has three entries: one for the Windows Boot
Manager, one for the Windows Legacy OS Loader, and one for the Windows
Boot Loader. Generally, the entry for the Windows Legacy OS Loader will
look similar to Example 2.
Example 2. Sample Legacy OS Loader Entry
Windows Legacy OS Loader
------------------------
identifier: {ntldr}
device: partition=C:
path: \ntldr
description: Earlier version of Windows
Although the Windows Boot Manager, Windows Legacy OS Loader, and
Windows Boot Loader are the primary types of entries that control
startup, the BCD
store also includes information about boot settings and boot utilities.
The Windows Boot Loader entry can have parameters that track the status
of boot settings, such as whether No Execute (NX) policy is set to Opt
In or Opt Out. The Windows Boot Loader entry also can provide
information about available boot utilities, such as the Windows Memory
Diagnostic utility.
To view the actual value of the GUIDs needed to manipulate entries in the BCD store, type bcdedit /v at an elevated command prompt.
Creating and Identifying the BCD Store
Using the BCD Editor, you can create a nonsystem BCD store by using the following command:
bcdedit /createstore StorePath
where StorePath is the folder path to the location where you want to create the nonsystem store, such as:
bcdedit /createstore c:\non-sys\bcd
On an EFI system, you can temporarily set the system store device by using the /sysstore command. Use the following syntax:
bcdedit /sysstore StoreDevice
where StoreDevice is the actual system store device identifier, such as:
bcdedit /sysstore c:
The device must be a system partition. Note that this setting does
not persist across reboots and is used only in cases where the system
store device is ambiguous.
Importing and Exporting the BCD Store
The BCD Editor provides separate commands for importing and exporting
the BCD store. You can use the /export command to export a copy of the
system BCD store’s contents to a specified folder. Use the following
command syntax:
bcdedit /export StorePath
where StorePath is the actual folder path to which you want to export a copy of the system store, such as:
bcdedit /export c:\backup\bcd
To restore an exported copy of the system store, you can use the /import command. Use the following command syntax:
bcdedit /import ImportPath
where ImportPath is the actual folder path from which you want to import a copy of the system store, such as:
bcdedit /import c:\backup\bcd
On an EFI system, you can add /clean to the /import command to
specify that all existing firmware boot entries should be deleted. Here
is an example:
bcdedit /import c:\backup\bcd /clean
Creating, Copying, and Deleting BCD Entries
The BCD Editor provides separate commands for creating, copying, and deleting entries in the BCD store. You can use the /create command to create identifier, application, and inherit entries in the BCD store.
As shown previously in Table 2, the BCD Editor recognizes many well-known identifiers, including {dbgsettings}, which is used to create a debugger settings entry; {ntldr}, used to create a Windows Legacy OS entry; and {ramdiskoptions}, used to create a RAM disk additional options entry. To create identifier entries, you use the following syntax:
bcdedit /create Identifier
/d "Description
"
where Identifier is a well-known identifier for the entry you want to create, such as:
bcdedit /create {ntldr} /d "Earlier Windows OS Loader"
You can create entries for specific boot loader applications as well, including:
-
Bootsector
Identifies a real-mode boot sector application; used to set the boot sector for a real-mode application.
-
Osloader
Identifies an operating system loader application; used to load Windows Vista or later.
-
Resume
Identifies a Windows Resume Loader application; used to resume the operating system from hibernation.
-
Startup
Identifies a real-mode application; used to identify a real-mode application.
Use the following command syntax:
bcdedit /create /application AppType
/d "Description"
where AppType is one of the previously listed application types, such as:
bcdedit /create /application osloader /d "Windows 8"
You can delete entries in the system store by using the /delete command and the following syntax:
bcdedit /delete Identifier
If you are trying to delete a well-known identifier, you must use the /f command to force deletion, such as:
bcdedit /delete {ntldr} /f
By default, when using the /delete command, the /cleanup option is implied, which means that the BCD
Editor cleans up any other references to the entry being deleted. This
ensures that the data store doesn’t have invalid references to the
identifier you removed. Because entries are removed from the display
order as well, this could result in a different default operating system
being set. If you want to delete the entry and clean up all other
references except the display order entry, you can use the /nocleanup
command.
After you create an entry, you need to set additional entry option values as necessary. The basic syntax for setting values is:
bcdedit /set Identifier Option Value
where Identifier is the identifier of the entry to be modified, Option is the option you want to set, and Value is the option value, such as:
bcdedit /set {current} device partition=d:
To delete options and their values, use the /deletevalue command with the following syntax:
bcdedit /deletevalue Identifier Option
where Identifier is the identifier of the entry to be modified, and Option is the option you want to delete, such as:
bcdedit /deletevalue {current} badmemorylist
When you are working with options, Boolean values can be entered in
several different ways. For True, you can use 1, On, Yes, or True. For
False, you can use 0, Off, No, or False.
To view the BCD entries for all boot utilities and the values for settings, type bcdedit /enum all /v
at an elevated command prompt. This command enumerates all BCD entries
regardless of their current state and lists them in verbose mode. Each
additional entry has a specific purpose and lists values that you can
set, including the following:
-
Resume From Hibernate
The Resume
From Hibernate entry shows the current configuration for the resume
feature. The pre–operating system boot utility that controls resume is Winresume.exe,
which in this example is stored in the C:\Windows\System32 folder. The
hibernation data, as specified in the FilePath parameter, is stored in
the Hiberfil.sys file in the root folder on the OSDevice (C: in this
example). Because the resume feature works differently if the computer
has Physical Address Extension (PAE) and debugging enabled, these
options are tracked by the Pae and DebugOptionEnabled parameters.
-
Windows Memory Tester
The Windows Memory Tester entry shows the current configuration for the Windows Memory Diagnostic utility. The pre–operating system boot utility that controls memory diagnostics is Memtest.exe. Because the Windows Memory Diagnostic utility is designed to detect bad memory by default, the BadMemoryAccess parameter is set to Yes by default. You can turn this feature off by entering bcdedit /set {memdiag} badmemoryaccess NO.
With memory diagnostics, you can configure the number of passes by
using Passcount and the test mix as Basic or Extended by using Testmix.
Here is an example: bcdedit /set {memdiag} passcount 2 textmix basic.
-
Windows Legacy OS Loader
The Windows Legacy
OS Loader entry shows the current configuration for the loading of
earlier versions of Windows. The Device parameter sets the default
partition to use, such as C:, and the Path parameter sets the default
path to the loader utility, such as Ntldr.
-
EMS Settings
The EMS Settings entry shows the configuration used when booting with EMS. Individual Windows Boot Loader entries control whether EMS is enabled. If EMS is provided by the BIOS and you want to use the BIOS settings, you can enter bcdedit /emssettings bios. With EMS, you can set an EMS port and an EMS baud rate as well. Here is an example: bcdedit /emssettings EMSPORT:2 EMSBAUDRATE:115200.
You can enable or disable EMS for a boot application by using /bootems,
following the identity of the boot application with the state you want,
such as On or Off.
-
Debugger Settings
The Debugger
Settings entry shows the configuration used when booting with the
debugger turned on. Individual Windows Boot Loader entries control
whether the debugger is enabled. You can view the hypervisor debugging
settings by entering bcdedit /dbgsettings. When debug booting is turned on, DebugType sets the type of debugger as SERIAL, 1394, or USB. With SERIAL debugging, DebugPort specifies the serial port being used as the debugger port, and BaudRate
specifies the baud rate to be used for debugging. With 1394 debugging,
you can use Channel to set the debugging channel. With USB debugging,
you can use TargetName to set the USB target name to be used for debugging. With any debug type, you can use the /Noumex flag to specify that user-mode exceptions should be ignored. Here are examples of setting the debugging mode: bcdedit
/dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200, bcdedit /dbgsettings
1394 CHANNEL:23, bcdedit /dbgsettings USB TARGETNAME:DEBUGGING.
-
Hypervisor Settings
The Hypervisor Settings entry shows the configuration used when working
with the hypervisor with the debugger turned on. Individual Windows
Boot Loader entries control whether the debugger is enabled. You can
view the hypervisor debugging settings by entering bcdedit /hypervisorsettings.
When hypervisor debug booting is turned on, HypervisorDebugType sets
the type of debugger, HypervisorDebugPort specifies the serial port
being used as the debugger port, and HypervisorBaudRate specifies the
baud rate to be used for debugging. These parameters work the same as
with Debugger Settings. Here is an example: bcdedit /hypervisorsettings SERIAL DEBUGPORT:1 BAUDRATE:115200. You can also use FireWire for hypervisor debugging. When you do, you must separate the word channel from the value with a colon as shown in this example: bcdedit /hypervisorsettings 1394 CHANNEL:23.
Table 3 summarizes key options that apply to entries for boot applications (Bootapp). Because Windows Boot Manager, Windows Memory Diagnostic, Windows OS Loader, and Windows Resume Loader are boot applications, these options apply to them as well.
Table 3. Key Options for Boot Application Entries
OPTION |
VALUE DESCRIPTION |
---|
BadMemoryAccess |
When true, allows an application to use the memory on the bad memory
list. When false, applications are prevented from using memory on the
bad memory list. |
BadMemoryList |
An integer list that defines the list of Page Frame Numbers of faulty memory in the system. |
BaudRate |
Sets an integer value that defines the baud rate for the serial debugger. |
BootDebug |
Sets a Boolean value that enables or disables the boot debugger. |
BootEMS |
Sets a Boolean value that enables or disables EMS. |
Channel |
Sets an integer value that defines the channel for the 1394 debugger. |
ConfigAccessPolicy |
Sets the access policy to use as either DEFAULT or DISALLOWMMCONFIG. |
DebugAddress |
Sets an integer value that defines the address of a serial port for the debugger. |
DebugPort |
Sets an integer value that defines the serial port number for the serial debugger. |
DebugStart |
Can be set to ACTIVE, AUTOENABLE, or DISABLE. |
DebugType |
Can be set to SERIAL, 1394, or USB. |
EMSBaudRate |
Defines the baud rate for EMS. |
EMSPort |
Defines the serial port number for EMS. |
FirstMegaBytePolicy |
Sets the first megabyte policy to use as USENONE, USEALL, or USEPRIVATE. |
GraphicsModeDisabled |
Sets a Boolean value that enables or disables graphics mode. |
GraphicsResolution |
Defines the graphics resolution, such as 1024 x 768 or 800 x 600. |
Locale |
Sets the locale of the boot application. |
Noumex |
When Noumex is set to TRUE, user-mode exceptions are ignored. When Noumex is set to FALSE, user-mode exceptions are not ignored. |
NoVESA |
Sets a Boolean value that enables or disables the use of Video Electronics Standards Association (VESA) display modes. |
RecoveryEnabled |
Sets a Boolean value that enables or disables the use of a recovery sequence. |
RecoverySequence |
Defines the recovery sequence to use. |
TargetName |
Defines the target name for the USB debugger as a string. |
TestSigning |
Sets a Boolean value that enables or disables use of prerelease test-code signing certificates. |
TruncateMemory |
Sets a physical memory address at or above which all memory is disregarded. |
Table 4 summarizes key options that apply to entries for Windows OS Loader (Osloader) applications.
Table 4. Key Options for Windows OS Loader Applications
OPTION |
VALUE DESCRIPTION |
---|
AdvancedOptions |
Sets a Boolean value that enables or disables advanced options. |
BootLog |
Sets a Boolean value that enables or disables the boot initialization log. |
BootStatusPolicy |
Sets the boot status policy. Can be DisplayAllFailures, IgnoreAllFailures, IgnoreShutdownFailures, or IgnoreBootFailures. |
ClusterModeAddressing |
Sets the maximum number of processors to include in a single Advanced Programmable Interrupt Controller (APIC) cluster. |
ConfigFlags |
Sets processor-specific configuration flags. |
DbgTransport |
Sets the file name for a private debugger transport. |
Debug |
Sets a Boolean value that enables or disables kernel debugging. |
DriverLoadFailurePolicy |
Sets the driver load failure policy. Can be Fatal or UseErrorControl. |
Ems |
Sets a Boolean value that enables or disables kernel EMS. |
Hal |
Sets the file name for a private HAL. |
HalBreakPoint |
Sets a Boolean value that enables or disables the special HAL breakpoint. |
HypervisorLaunchType |
Configures the hypervisor launch type. Can be Off or Auto. |
IncreaseUserVA |
Sets an integer value (in megabytes) that increases the amount of virtual address space that the user-mode processes can use. |
Kernel |
Sets the file name for a private kernel. |
LastKnownGood |
Sets a Boolean value that enables or disables booting to the last known good configuration. |
MaxProc |
Sets a Boolean value that enables or disables the display of the maximum number of processors in the system. |
Msi |
Sets the message signaled interrupt (MSI) to use. Can be Default or ForceDisable. |
NoCrashAutoReboot |
Sets a Boolean value that enables or disables automatic restart on crash. |
NoLowMem |
Sets a Boolean value that enables or disables the use of low memory. |
NumProc |
Sets the number of processors to use on startup. |
Nx |
Controls no-execute protection. Can be OptIn, OptOut, AlwaysOn, or AlwaysOff. |
OneCPU |
Sets a Boolean value that forces or does not force only the boot CPU to be used. |
OptionsEdit |
Sets a Boolean value that enables or disables the options editor. |
OSDevice |
Defines the device that contains the system root. |
Pae |
Controls PAE. Can be Default, ForceEnable, or ForceDisable. |
PerfMem |
Sets the size (in megabytes) of the buffer to allocate for performance data logging. |
RemoveMemory |
Sets an integer value (in megabytes) that removes memory from the total available memory that the operating system can use. |
RestrictAPICCluster |
Sets the largest APIC cluster number to be used by the system. |
ResumeObject |
Sets the identifier for the resume object that is associated with this operating system object. |
SafeBoot |
Sets the computer to use a Safe Boot mode. Can be Minimal, Network, or DsRepair. |
SafeBootAlternateShell |
Sets a Boolean value that enables or disables the use of the alternate shell when booted into safe mode. |
Sos |
Sets a Boolean value that enables or disables the display of additional boot information. |
SystemRoot |
Defines the path to the system root. |
UseFirmwarePCISettings |
Sets a Boolean value that enables or disables use of BIOS-configured PCI resources. |
UsePhysicalDestination |
Sets a Boolean value that forces or does not force the use of the physical APIC. |
Vga |
Sets a Boolean value that forces or does not force the use of the VGA display driver. |
WinPE |
Sets a Boolean value that enables or disables booting to Windows Preinstallation Environment (Windows PE). |
Changing Data Execution Prevention and Physical Address Extension Options
Data Execution Prevention (DEP)
is a memory-protection technology. When DEP is enabled, the computer’s
processor marks all memory locations in an application as nonexecutable
unless the location explicitly contains executable code. If code is
executed from a memory page marked as nonexecutable, the processor can
raise an exception and prevent the code from executing. This behavior
prevents malicious application code, such as virus code, from inserting
itself into most areas of memory.
For computers with processors that support the non-execute (NX)
page-protection feature, you can configure the operating system to opt
in to NX protection by setting the nx parameter to OptIn, or opt out of
NX protection by setting the nx parameter to OptOut. Here is an example:
bcdedit /set {current} nx optout
When you configure NX protection to OptIn, DEP
is turned on only for essential Windows programs and services. This is
the default. When you configure NX protection to OptOut, all programs
and services—not just standard Windows programs and services—use DEP. You can also configure NX protection to be always on or always off by using AlwaysOn or AlwaysOff, such as:
bcdedit /set {current} nx alwayson
Processors that support and opt in to NX protection must be running
in PAE mode. You can configure PAE by setting the PAE parameter to
Default, ForceEnable, or ForceDisable. When you set the PAE state to
Default, the operating system uses its default configuration for PAE.
When you set the PAE state to ForceEnable, the operating system uses
PAE. When you set the PAE state to ForceDisable, the operating system
will not use PAE. Here is an example:
bcdedit /set {current} pae default
Changing the Operating System Display Order
You can change the display order of boot
managers associated with a particular installation of Windows Vista,
Windows 7, or Windows 8 by using the /displayorder command. The syntax
is:
bcdedit /displayorder id1
id2
... idn
where id1 is the operating system identifier of the first operating system in the display order, id2
is the identifier of the second, and so on. You could change the
display order of the operating systems identified in these BCD entries:
Windows Boot Loader
-------------------
identifier {16b857b4-9e02-11e0-9c17-b7d085eb0682}
Windows Boot Loader
-------------------
identifier {14504de-e96b-11cd-a51b-89ace9305d5e}
Windows Boot Loader
-------------------
identifier {8b78e48f-02d0-11dd-af92-a72494804a8a}
by using the following command:
bcdedit /displayorder {8b78e48f-02d0-11dd-af92-a72494804a8a}
{16b857b4-9e02-11e0-9c17-b7d085eb0682}
{14504de-e96b-11cd-a51b-89ace9305d5e}
You can set a particular operating system as the first entry by using /addfirst with /displayorder, such as:
bcdedit /displayorder {16b857b4-9e02-11e0-9c17-b7d085eb0682} /addfirst
You can set a particular operating system as the last entry by using /addlast with /displayorder, such as:
bcdedit /displayorder {8b78e48f-02d0-11dd-af92-a72494804a8a} /addlast
Changing the Default Operating System Entry
You can change the default operating system entry by using the /default command. The syntax for this command is:
bcdedit /default id
where id is the operating system ID in the boot loader entry. You could set the operating system identified in this BCD entry as the default:
Windows Boot Loader
-------------------
identifier {16b857b4-9e02-11e0-9c17-b7d085eb0682}
by using the following command:
bcdedit /default {16b857b4-9e02-11e0-9c17-b7d085eb0682}
If you want to use a pre–Windows 8 operating system as the default,
use the identifier for the Windows Legacy OS Loader. The related BCD
entry looks like this:
Windows Legacy OS Loader
------------------------
identifier {466f5a88-0af2-4f76-9038-095b170dc21c}
device partition=C:
path \ntldr
description Earlier Microsoft Windows Operating System
Following this, you could set Ntldr as the default by entering:
bcdedit /default {466f5a88-0af2-4f76-9038-095b170dc21c}
Changing the Default Timeout
You can change the timeout value associated with the default
operating system by using the /timeout command. Set the /timeout command
to the wait time you want to use (in seconds) as follows:
bcdedit /timeout 30
To boot automatically to the default operating system, set the timeout to 0 seconds.
Changing the Boot Sequence Temporarily
Occasionally, you might want to boot to a particular operating system
one time and then revert to the default boot order. To do this, you can
use the /bootsequence command. Follow the command with the identifier
of the operating system to which you want to boot after restarting the
computer, such as:
bcdedit /bootsequence {16b857b4-9e02-11e0-9c17-b7d085eb0682}
When you restart the computer, the computer
will set the specified operating system as the default for that restart
only. Then, when you restart the computer again, the computer will use
the original default boot order.