Sunday, August 5, 2012

How to Use the BCDEDIT

1.      Open up the command line as an administrator rights (right click on the       
      Shortcut, Run As and lets you run as an admin if your on a non-admin account)

2.  Type bcdedit
         Output will be as below:

A boot entry consists of 4 main elements:
1. Identifier: The identifier is how the system has named the boot entry.
2. Device: The device is the drive or virtual image that the system will use to boot the   
                   Boot entry.
3. Path: The path is the location on the device where the bootloader file is found.
4. Description: The description is the friendly name we give to our boot entry, e.g.
                           "Windows 7"
IMPORTANT: Make a backup of your BCD file first. To do that, type:

           bcdedit /export C:\SAVEDBCD

This will create a file c:\savebcd which is your boot entry backup.
If you mess up, you can always undo changes by:

           bcdedit /import c:\savedbcd

Now to see how we can control the entries, here are some examples:

      bcdedit /set {current} description "My edited Windows Boot Entry"
NOTE: This changes the title of the boot menu entry "{current}".

      bcdedit /set {ntldr} device partition=E:
NOTE: This tells bcd that Windows 7 partition is drive E:

       bcdedit /set {ntldr} path \ntldr
NOTE: This tells bcd that the ntldr file which is the win7 bootloader is on root folder "\" (of  
            drive e: as stated above)

       bcdedit /displayorder {ntldr} /addfirst
NOTE: This places Windows 7 as the first OS on the menu list.

       bcdedit /default {ntldr}
NOTE: This places Windows 7 as the default OS to boot first with.

         bcdedit /displayorder {33342343-3424-2342342342-2344} /addlast
NOTE: This tells bcd that the boot entry with UUID 3334... Should be the last entry on the menu.

You can always type just bcdedit to see your current settings.

You can use BCDEDIT to alter any boot parameter, like in msconfig.

         bcdedit /timeout 5
NOTE: This sets the wait-to-select-OS menu timeout at startup to 5 seconds. You will notice that I didn't give a UUID above. If you omit the UUID, it applies automatically to the relevant UUID. So: bcdedit /timeout 5 is identical to bcdedit /set {bootmgr} timeout 5

To create a new boot entry to load Windows 7 from a partition on your disk:

NOTE: The example below uses F: as the Windows 7 partition. Replace with your 7 drive letter.
        bcdedit /create {ntldr} /d "Windows 7"

        bcdedit /set {ntldr} device partition=F:

        bcdedit /set {ntldr} path \ntldr