Freigeben über


BCDboot Command-Line Options

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

The BCDboot tool is a command-line tool that enables you to manage system partition files. You can use the tool in the following scenarios:

  • Set up boot files on the system partition when you deploy new PCs. For more information, see Capture and Apply Windows, System, and Recovery Partitions.

  • Set up Windows® to boot to a virtual hard disk (VHD) file. For instructions, see Boot to VHD (Native Boot): Add a Virtual Hard Disk to the Boot Menu.

  • Repair the system partition. If the system partition has been corrupted, you can use BCDboot to recreate the system partition files by using new copies of these files from the Windows partition.

  • Set up or repair the boot menu on a dual-boot PC. If you've installed more than one copy of Windows on a PC, you can use BCDboot to add or repair the boot menu.

File Locations

The BCDboot.exe file is included in each of the following locations:

In Windows PE 3.x and Windows PE 4.x:

%WINDIR%\System32

In Windows® 8, Windows® 7, Windows Server® 2012, and Windows Server® 2008 R2:

%WINDIR%\System32

In the Windows Assessment and Deployment Kit (Windows ADK):

C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\BCDBoot

Supported operating systems

BCDboot can copy boot environment files from images of Windows 8.1, Windows 8, Windows 7, Windows Vista®, Windows Server 2012 R2, Windows Server® 2012, Windows Server® 2008 R2 or Windows Server® 2008.

How It Works

To configure the system partition, BCDboot copies a small set of boot-environment files from the installed Windows image to the system partition. Next, BCDboot creates a Boot Configuration Data (BCD) store on the system partition that instructs the computer to boot to the Windows partition. On UEFI-based computers, BCDBoot adds a firmware entry in the NVRAM to point to these boot files.

BCDboot uses the %WINDIR%\System32\Config\BCD-Template file to create a new BCD store and initialize the BCD boot-environment files on the system partition. You can define specific BCD settings in the BCD-Template file. The BCDboot tool also copies the most recent versions of boot-environment files from the operating-system image %WINDIR%\boot folder to the system partition.

BCDboot can update an existing boot environment on the system partition:

  • BCDboot copies newer versions of files from the Windows image to the system partition.

  • If a BCD store already exists on the system partition, BCDboot creates a new boot entry in the existing BCD store, based on settings in the BCD-Template file.

  • If there is already a boot entry for this Windows partition, by default, BCDboot erases the old boot entry and its values. To retain the values from an existing boot entry when you update the system files, you can use the /m option together with the BDCBoot.exe command.

Command-Line Options

The following command-line options are available for BCDboot.exe.

BCDBOOT <source> [/l <locale>] [/s <volume-letter> [/f <firmware type>]] [/v] [/m [{OS Loader GUID}]]

Option Description

<source>

Required. Specifies the location of the Windows directory to use as the source for copying boot-environment files.

The following example initializes the system partition by using BCD files from the C:\Windows folder:

bcdboot C:\Windows

/l <locale>

Optional. Specifies the locale. The default is US English (en-us).

The following example sets the default BCD locale to Japanese:

bcdboot C:\Windows /l ja-jp

/s <volume letter>

Optional. Specifies the volume letter of the system partition. This option should not be used in typical deployment scenarios.

Use this setting to specify a system partition when you are configuring a drive that will be booted on another computer, such as a USB flash drive or a secondary hard drive.

UEFI:

  • BCDBoot copies the boot files to either the EFI system partition, or the partition specified by the /s option.

    BCDBoot creates the BCD store in the same partition.

    By default, BCDboot creates a Windows Boot Manager entry in the NVRAM on the firmware to identify the boot files on the system partition. If the /s option is used, then this entry is not created. Instead, BCDboot relies on the default firmware settings to identify the boot files on the system partition. By the UEFI 2.3.1 spec, the default firmware settings should open the file: \efi\boot\bootx64.efi in the EFI System Partition (ESP).

BIOS:

  1. BCDBoot copies the boot files to either the active partition on the primary hard drive, or the partition specified by the /s option.

  2. BCDBoot creates the BCD store in the same partition.

The following example copies BCD files from the C:\Windows folder to a system partition on a secondary hard drive that will be booted on another computer. The system partition on the secondary drive was assigned the volume letter S:

bcdboot C:\Windows /s S:

The following example creates boot entries on a USB flash drive with the volume letter F, including boot files to support either a UEFI-based or a BIOS-based computer:

bcdboot C:\Windows /s F: /f ALL

/f <firmware type>

Optional. Specifies the firmware type. Valid values include UEFI, BIOS, and ALL.

  • On BIOS/MBR-based systems, the default value is BIOS. This option creates the \Boot directory on the system partition and copies all required boot-environment files to this directory.

  • On UEFI/GPT-based systems, the default value is UEFI. This option creates the \Efi\Microsoft\Boot directory and copies all required boot-environment files to this directory.

  • When you specify the ALL value, BCDboot creates both the \Boot and the \Efi\Microsoft\Boot directories, and copies all required boot-environment files for BIOS and UEFI to these directories.

If you specify the /f option, you must also specify the /s option to identify the volume letter of the system partition.

The following example copies BCD files that support booting on either a UEFI-based or a BIOS-based computer from the C:\Windows folder to a USB flash drive that was assigned the volume letter F:

bcdboot C:\Windows /s F: /f ALL 

/v

Optional. Enables verbose mode. Example:

bcdboot C:\Windows /v

/m [{OS Loader GUID}]

Optional. Merges the values from an existing boot entry into a new boot entry.

By default, this option merges only global objects. If you specify an OS Loader GUID, this option merges the loader object in the system template to produce a bootable entry.

The following example merges the operating-system loader in the current BCD store that the specified GUID identifies in the new BCD store:

bcdboot c:\Windows /m {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

Repair the system partition

If the system partition has been corrupted, you can use BCDboot to recreate the system partition files by using new copies of these files from the Windows partition.

  1. Boot your PC to a command line. For example, boot to the Windows installation disk and press Shift+F10, or boot to Windows PE (WinPE: Create USB Bootable drive).

  2. Use Diskpart to determine which drive letter contains your Windows partition and system partition (diskpart, list vol, exit).

  3. Optional: Format your system partition: format (drive letter of your system partition) /q

  4. Add a boot entry for your Windows partition: bcdboot D:\Windows

  5. Reboot the PC. Windows should appear.

Set up or repair the boot menu on a dual-boot PC

When setting up a PC to boot more than one operating system, you may sometimes lose the ability to boot into one of the operating systems. The BCDBoot option allows you to quickly add boot options for a Windows-based operating system. To set up a dual-boot PC:

  1. Install a separate hard drive or prepare a separate partition for each operating system.

  2. Install the operating systems. For example, if your PC has Windows 7, install Windows 8.1 onto the other hard drive or partition.

  3. Reboot the PC. The boot menus should appear with both operating systems listed.

    If both operating systems aren't listed:

    1. Open a command line, either as an administrator from inside Windows, or by booting to a command line using the Windows installation disk and presssing Shift+F10, or by booting to Windows PE (WinPE: Create USB Bootable drive).

    2. Add boot options for a Windows operating system.

      Bcdboot D:\Windows
      
    3. Reboot the PC. Now, the boot menu will show both menu options.

Troubleshooting

For information about repairing the boot files on a PC with Windows XP and a more recent version of Windows such as Windows 7), see https://go.microsoft.com/fwlink/?LinkId=234039.

See Also

Tasks

Capture and Apply Windows, System, and Recovery Partitions

Reference

Bootsect Command-Line Options

Concepts

Configure BIOS/MBR-Based Hard Drive Partitions
Configure UEFI/GPT-Based Hard Drive Partitions

Other Resources

BCDedit
Diskpart Command line syntax