Using BCDEDIT to Customize the Startup Options
The System Configuration
Utility makes it easy to modify BCD store items, but it doesn’t give you
access to the entire BCD store. For example, the Boot tab doesn’t list
any legacy boot items on your system, and there are no options for
renaming boot items, or changing the order in which the boot items are
displayed in the Windows Boot Manager menu. For these tasks, and indeed
for every possible BCD task, you need to use the BCDEDIT command-line
tool.
Note
that BCDEDIT is an Administrator-only tool, so you must run it under
the Administrator account (not just any account in the Administrators
group). The easiest way to do this is elevate your privileges when
running the Command Prompt, as described in the following steps:
1. | Select Start, All Programs, Accessories.
|
2. | Right-click Command Prompt and then click Run as Administrator. The User Account Control dialog box appears.
|
3. | Either click Continue or type an administrator password and click Submit. The Command Prompt window appears
|
Table 1 summarizes the switches you can use with BCDEDIT.
Table 1. Switches Available for the BCDEDIT Command-Line Tool
Switch | Description |
---|
/bootdebug | Toggles boot debugging for a boot application on and off |
/bootems | Toggles Emergency Management Services for a boot application on and off |
/bootsequence | Sets the one-time boot sequence for the boot manager |
/copy | Makes a copy of an entry |
/create | Creates a new entry |
/createstore | Creates a new and empty BCD store |
/dbgsettings | Sets the global debugger settings |
/debug | Toggles kernel debugging for an operating system entry |
/default | Sets the default entry |
/delete | Deletes an entry |
/deletevalue | Deletes an entry value |
/displayorder | Sets the order in which Boot Manager displays the operating system entries |
/ems | Enables or disables Emergency Management Services for an operating system entry |
/emssettings | Sets the global Emergency Management Services settings |
/enum | Lists the entries in the BCD store |
/export | Exports the contents of the BCD store to a file |
/import | Restores the BCD store from a backup file created with the /export switch |
/set | Sets an option value for an entry |
/store | Specifies the BCD store to use |
/timeout | Sets the Boot Manager timeout value |
/toolsdisplayorder | Sets the order in which Boot Manager displays the Tools menu |
/types | Displays the data types required by the /set and /deletevalue commands. |
/v | Displays all entry identifiers in full, instead of using well-known identifiers |
To help you understand how BCDEDIT works, let’s examine the output that appears when you run BCDEDIT with the /enum switch:
Windows Boot Manager
--------------------
Identifier: {bootmgr}
Type: 10100002
Device: partition=C:
Description: Windows Boot Manager
Inherit options: {globalsettings}
Boot debugger: No
Default: {current}
Display order: {ntldr}
{current}
{a8ef3a39-a0a4-11da-bedf-97d9bf80e36c}
Tools display order: {memdiag}
Timeout: 30
Windows Legacy OS Loader
------------------------
Identifier: {ntldr}
Type: 10300006
Device: partition=C:
Path: \ntldr
Description: Earlier version of Windows
Boot debugger: No
Windows Boot Loader
-------------------
Identifier: {current}
Type: 10200003
Device: partition=C:
Path: \Windows\system32\winload.exe
Description: Microsoft Windows Vista
Locale: en-US
Inherit options: {bootloadersettings}
Boot debugger: Yes
Windows device: partition=D:
Windows root: \Windows
Resume application: {c105ff07-b93e-11da-82e5-ae629af91d6e}
No Execute policy: OptIn
Kernel debugger: No
EMS enabled in OS: No
Windows Boot Loader
-------------------
Identifier: {a8ef3a39-a0a4-11da-bedf-97d9bf80e36c}
Type: 10200003
Device: partition=G:
Path: \Windows\system32\winload.exe
Description: Microsoft Windows Vista
Locale: en-US
Inherit options: {bootloadersettings}
Boot debugger: No
Windows device: partition=G:
Windows root: \Windows
Resume application: {a8ef3a3a-a0a4-11da-bedf-97d9bf80e36c}
No Execute policy: OptIn
No integrity checks: Yes
Kernel debugger: No
EMS enabled in OS: No
As you can see, this BCD
store has four entries: one for Windows Boot Manager, one for a legacy
Windows install (on partition C:), and two for Vista installs (on my
text machine, partitions D: and G:). Notice that each entry has an Identifier setting, and these IDs are unique to each entry. All IDs are actually 32-digit globally unique identifiers (GUIDs) such as the one shown earlier for the second Windows Boot Loader item:
a8ef3a39-a0a4-11da-bedf-97d9bf80e36c
The other entries have GUIDs, as well, but by default BCDEDIT works with a collection of well-known identifiers, including the following (type bcdedit id /? to see the complete list):
|
|
---|
bootmgr | The Windows Boot Manager entry |
ntldr | An entry that uses a legacy operating system loader (NTLDR) to boot previous versions of Windows |
current | The entry that corresponds to the operating system that is currently running |
default | The entry that corresponds to the Windows Boot Manager default operating system |
memdiag | The Windows Memory Diagnostics entry |
If you want to see the full GUIDs for every entry, add the /v (verbose) switch:
It would take dozens of
pages to run through all the BCDEDIT switches, so I’ll just give you a
few examples so you can get a taste of how this powerful utility
operates.
Making a Backup Copy of the BCD Store
Before you do any work on
the BCD store, you should make a backup copy. That way, if you make an
error when you change something in the BCD, you can always restore the
backup copy to get your system back to its original state.
You create a backup copy using the /export switch. For example, the following command backs up the BCD store to a file named bcd_backup in the root folder of drive C:
bcdedit /export c:\bcd_backup
If you need to restore the backup, use the /import switch, as in this example:
bcdedit /import c:\bcd_backup
Renaming an Entry
The names that
Windows Boot Manager assigns to the boot applications leave a lot to be
desired. For a legacy operating system entry, for example, the default Legacy (pre-Longhorn) Microsoft Windows Operating System name is overly long and not particularly descriptive. A simpler name such as Windows XP Pro or Windows 2000 would be much more useful. Similarly, all Vista installs get the same name: Microsoft Windows, which can be quite confusing. Names such as Vista Home Premium and Vista Ultimate would be much more understandable.
To rename an entry using BCDEDIT, use the following syntax:
bcdedit /set {id} description “name”
Here, replace id with the entry identifier (the GUID or the well-known identifier, if applicable) and replace name
with the new name you want to use. For example, the following command
replaces the current name of the legacy operating system entry (ntldr) with Windows XP Pro:
bcdedit /set {ntldr} description “Windows XP Pro”
Tip
GUIDs are 32-character values, so typing them by hand is both time-consuming and error-prone. To avoid this, first run the bcdedit /enum
command to enumerate the BCD entries, and then scroll up until you see
the GUID of the entry with which you want to work. Pull down the system
menu (click the upper-left corner of the window or press Alt+Spacebar),
select Edit, Mark, click-and-drag over the GUID to select it, and then
press the Enter key to copy it. Begin typing your BCDEDIT command and
when you get to the part where the identifier is required, pull down the
system menu again and select Edit, Paste.
Changing the Order of the Entries
If you’d prefer that the Boot Manager menu entries appear in a different order, you can use BCDEDIT’s /displayorder
switch to change the order. In the simplest case, you might want to
move an entry to either the beginning or the end of the menu. To send an
entry to the beginning, include the /addfirst switch. Here’s an example:
bcdedit /displayorder {a8ef3a39-a0a4-11da-bedf-97d9bf80e36c} /addfirst
To send an entry to the end of the menu, include the /addlast switch instead, as in this example:
bcdedit /displayorder {current} /addfirst
To set the overall order, include each identifier in the order you want, separated by spaces:
bcdedit /displayorder {current} {a8ef3a39-a0a4-11da-bedf-97d9bf80e36c} {ntldr}