3. How to Use BCDEdit
The BCDEdit command-line tool provides you almost unlimited control over the BCD registry file and configuration settings.
Note
If
you have a computer with both Windows XP and Windows Vista installed
and you want to modify the BCD registry file from Windows XP, you can
run BCDEdit from Windows XP by launching it directly from the Windows
Vista Windows\System32 folder. While this might be useful in some
multi-boot configurations, typically, you should run BCDEdit from the
System Recovery command prompt if you cannot load Windows Vista. |
You must use administrative credentials to run BCDEdit from within Windows Vista. To do this, follow these steps:
1. | Click Start, click All Programs, and then click Accessories.
|
2. | Right-click Command Prompt and then click Run As Administrator.
|
3. | Click Continue when prompted by User Account Control.
|
To view detailed information about using BCDEdit, run BCDEdit /? from a command prompt. The following sections describe how to perform specific tasks with BCDEdit.
How to Interpret BCDEdit Output
You can view settings currently defined in your BCD registry file by using the bcdedit /enum command. Optionally, you can follow the command with one of the following parameters to change which entries are displayed:
Active The default setting that is displayed if you run bcdedit /enum without any additional parameters. Displays all entries in the boot manager display order.
Firmware Displays all firmware applications.
Bootapp Displays all boot environment applications.
Osloader Displays all operating system entries.
Resume Displays all resume from hibernation entries.
Inherit Displays all inherit entries.
All Displays all entries.
For
example, to view the startup entry used to resume from hibernation, run
the following command at an administrative command prompt:
Similarly, to view all startup entries, use the following command:
How to Back Up and Restore Settings
Making
changes to your BCD registry file can render your computer unbootable.
Therefore, before making changes to your BCD registry file, you should
make a backup copy, have a bootable Windows Vista DVD available, and be
prepared to restore the original BCD registry file.
To make a backup of your current BCD registry, call the BCDEdit /export command, as shown here:
bcdedit /export backupbcd.bcd
Later, you can restore your original BCD registry file by calling the BCDEdit /import command, as shown here:
bcdedit /import backupbcd.bcd
Note
The filename and extension you use are not significant. |
How to Change the Default Operating System Entry
To view the current default operating system entry, run the following command and look for the default line:
bcdedit /enum {bootmgr}
Windows Boot Manager
---------------------
identifier {bootmgr}
device partition=D:
description Windows Boot Manager
locale en-US
inherit {globalsettings} default
{current}
resumeobject {24a500f3-12ea-11db-a536-b7db70c06ac2}
displayorder {ntldr}
{current}
{dff40777-015d-11db-865c-d47e9be63989}
toolsdisplayorder {memdiag}
timeout 30
To
change the default operating system entry, first run the following
command to view the existing entries, and make note of the identifier
for the entry that you want to be the default:
Then run the following command to set a new default (where <id> is the identifier for the new entry:
For example, to configure
the Windows Boot Manager to start the previous version of Windows by
default (which is identified as {ntldr}), run the following command:
To configure the currently running instance of Windows Vista as the default, run the following command:
bcdedit /default {current}
How to Change the Default Boot Entry
The
boot menu, by default, is displayed for 30 seconds if you have more
than one boot menu entry. If you have only one boot menu entry, the
menu is not displayed at all (though the boot manager does wait several
seconds so that you can press a key to view the menu).
To change the time-out for the boot menu, use the bcdedit /timeout seconds command, as shown here:
How to Change the Order of Boot Manager Menu Items
To change the order of boot manager menu items, use the bcdedit /display command, and then list the menu item identifiers in the desired sequence, as shown in the following example:
bcdedit /display {current} {ntldr} {cbd971bf-b7b8-4885-951a-fa0344f5d71}
How to Create an Entry for Another Operating System
You
can use BCDEdit to create an entry for an operating system other than
Windows Vista. You may need to add boot entries to the BCD registry
file if you want to be able to load different operating systems on a
single computer. While Windows Vista automatically creates boot entries
for existing operating systems when installed, you might need to
manually add a boot entry if you install another operating system after
Windows Vista, or if you want to load an operating system from a newly
attached hard disk.
By default, the BCD
registry file contains an entry called {ntldr} that is configured to
start an older version of Windows from your C:\ partition. If you only
have one older operating system and Earlier Version Of Windows does not
currently appear on the computer’s boot menu, you can use this existing
entry to start the older operating system. To do this, call BCDEdit /set to configure the boot volume. Then add the entry to the Windows Boot Manager operating system menu by calling the BCDEdit /displayorder command. The following code demonstrates how to do this:
REM Modify the following line to identify the other OS' partition
REM The following line could also be, "bcdedit /set {ntldr} device boot"
bcdedit /set {ntldr} device partition=C:
REM 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.
If
you need to be able to choose from multiple legacy Windows operating
systems, you should choose the {ntldr} entry from the boot menu. The
Windows Boot Manager will then pass control to NLTDR, which will
display a menu based on the Boot.ini file that you can use to choose
from all Windows operating systems.
If you want to create an entry for a non-Microsoft operating system, you can either create an entry using the bcdedit /create
command, or you can copy the existing {ntldr} entry and update it for
the operating system. To base a new entry on {ntldr}, copy the entry,
update the boot loader path, and then add it to the boot menu by
following these commands:
bcdedit /copy {ntldr} /d "Other operating system (or other description)"
REM The previous command will display a new GUID that identifies the copy.
REM Use the GUID in the following command, and modify the partition identifier as needed.
bcdedit /set {NEW-GUID} device partition=C:
Note
Don’t
retype the GUID by hand—you’re likely to make a mistake. Instead, copy
it to the clipboard. Click the command menu in the upper-left corner of
the command prompt window, click Edit, and then click Mark. Select the
GUID text (including the brackets) and then press Enter on your
keyboard. To paste the GUID to the command prompt, click the command
menu, click Edit, and then click Paste. |
Now run the following command to identify the operating system’s boot loader:
REM Replace the last parameter with the boot loader filename
bcdedit /set {NEW-GUID} path \boot-loader
If
{ntldr} was not part of the boot menu when you copied it, you also need
to run the following command to add the copied entry to the boot menu:
bcdedit /displayorder {NEW-GUID} /addlast
Additionally, you might need to configure the operating system’s own boot loader.
How to Remove a Boot Entry
Typically,
you do not need to remove entries from the BCD registry file. Instead,
you should simply remove entries from the Windows Boot Manager menu. To
remove an entry from the menu, first run bcdedit /enum and note the boot entry’s identifier. Then run the following command, substituting the identifier:
bcdedit /displayorder {GUID} /remove
For example, to remove the entry to load the previous version of Windows from the boot menu, you would run:
bcdedit /displayorder {ntldr} /remove
You can later re-add the entry to the boot menu by calling the following command:
bcdedit /displayorder {GUID} /addlast
To permanently remove an entry from the BCD registry, run the following command:
bcdedit /delete {GUID} /remove
You should only permanently remove an entry if you have removed the operating system files from the computer.
How to View and Update Global Debugger Settings
To view debugger settings for startup entries, run the following command:
bcdedit /
dbgsettings DebugType [debugport:Port] [baudrate:Baud] [channel:Channel] [targetname:TargetName]
Replace the parameters with your custom settings, as described in the following list:
DebugType
Specifies the type of debugger. DebugType can be one of SERIAL, 1394,
or USB. The remaining options depend on the debugger type selected.
Port For SERIAL debugging, specifies the serial port to use as the debugging port.
Baud For SERIAL debugging, specifies the baud rate to be used for debugging.
Channel For 1394 debugging, specifies the 1394 channel to be used for debugging.
TargetName For Universal Serial Bus (USB) debugging, specifies the USB target name to be used for debugging.
For example, the following command sets the global debugger settings to serial debugging over com1 at 115,200 baud:
bcdedit /dbgsettings serial debugport:1 baudrate:115200
The following command sets the global debugger settings to 1394 debugging using channel 23:
bcdedit /dbgsettings 1394 CHANNEL:32
The following command sets the global debugger settings to USB debugging using target name debugging:
bcdedit /dbgsettings USB targetname:debugging
4. How to Remove the Windows Vista Boot Loader
If
you want to remove Windows Vista from a dual-boot environment that
includes an earlier version of Windows, follow these steps:
Note
You
can follow these steps in the earlier version of Windows or in Windows
Vista. If you follow these steps in Windows Vista, run the commands
from a command prompt that has elevated user rights. To do this, click
Start, click Accessories, right-click the command-prompt shortcut, and
then click Run As Administrator. |
1. | Use
Bootsect.exe to restore the Ntldr.exe program. To do this, type the
following command, where C:\ is the drive containing the Windows Vista
system files:
C:\Boot\Bootsect.exe –NT52 All
After the computer restarts, it does not load the
Windows Boot Manager program. Instead, Ntldr.exe loads and processes
the Boot.ini to start an earlier version of Windows.
|
2. | If
Windows Vista is not installed on the active partition, you can now
delete or remove the partition where Windows Vista is installed.
|