Examples - Part 1
The BCD Store used to boot the operating system may be in use as the system store - if a system store is in use then this will be the default store on which all bcdedit commands are carried out. If no system store is in use, or to specify a store other than the system store, the /store switch must be used.
I personally recommend using the /store switch whenever modifying a BCD store to reduce the risk of targeting the wrong store. To specify the BCD store D:\Boot\BCD we would use the command bcdedit.exe /store D:\Boot\BCD .....
Before modifying a BCD store I recommend that you create a backup. Be aware that modifying a BCD store could result in your system not booting, I therefore recommend that you take either of the following precautions -
- Create a BOOTMGR bootable CD/DVD/USB/Floppy with your existing (working) BCD store copied to it. BCD entries (with the exception of any devices set as BOOT) contain disk signature and partition offset information - booting the BCD store from another device will therefore still target the correct device.
- Create a WinPE bootable CD/DVD/USB disk and use this to replace a non-working BCD store with the backup you made earlier. If you do not have access to WinPE then many Linux Live distributions can also be used.
- Create a new (empty) store
- Create {bootmgr} entry
- Create entry for Windows Vista/7
- Create {ntldr} entry
- Create entry for VHD boot
- Create entry for Grub4dos
- Create {ramdiskoptions} entry
- Create entry for WinPE
- Using multiple {ramdiskoptions}
Create a new (empty) store
- bcdedit.exe /createstore C:\Boot\BCD
Create {bootmgr} entry
- bcdedit.exe /store C:\Boot\BCD /create {bootmgr}
- bcdedit.exe /store C:\Boot\BCD /set {bootmgr} description "Boot Manager"
- bcdedit.exe /store C:\Boot\BCD /set {bootmgr} device boot
- bcdedit.exe /store C:\Boot\BCD /set {bootmgr} timeout 20
Create entry for Windows Vista/7
The following entry will add a menu option for either Windows Vista or 7 - don't forget to change the description entry.- bcdedit.exe /store C:\Boot\BCD /create /application osloader
- bcdedit.exe /store C:\Boot\BCD /set {guid} device partition=C:
- bcdedit.exe /store C:\Boot\BCD /set {guid} path \Windows\system32\winload.exe
- bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice partition=C:
- bcdedit.exe /store C:\Boot\BCD /set {guid} systemroot \Windows
- bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows 7"
- bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast
Create {ntldr} entry
The {ntldr} option can be used to boot legacy operating systems including Windows 2000/XP/2003. This option is generally only used in dual or multiboot systems. The files boot.ini and ntdetect.com (from an existing Windows 2000/XP/2003) will need to be copied to the boot partition containing BOOTMGR and the BCD store.Don't forget to change the device partition= to the drive containing your own Windows 2000/XP/2003 installation. Also change the description as required.
- bcdedit.exe /store C:\Boot\BCD /create {ntldr}
- bcdedit.exe /store C:\Boot\BCD /set {ntldr} device partition=C:
- bcdedit.exe /store C:\Boot\BCD /set {ntldr} path \ntldr
- bcdedit.exe /store C:\Boot\BCD /set {ntldr} description "Windows XP"
- bcdedit.exe /store C:\Boot\BCD /displayorder {ntldr} /addlast
Create entry for VHD boot
At this time only Windows 7 (Ultimate and Enterprise) and Windows Server 2008 R2 can be booted from a VHD file. These commands will add an entry for an existing VHD installation. Edit the description and device path as required.- bcdedit.exe /store C:\Boot\BCD /create /application osloader
- bcdedit.exe /store C:\Boot\BCD /set {guid} device vhd=[C:]\vhd\seven.vhd
- bcdedit.exe /store C:\Boot\BCD /set {guid} path \Windows\system32\winload.exe
- bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice vhd=[C:]\vhd\seven.vhd
- bcdedit.exe /store C:\Boot\BCD /set {guid} systemroot \Windows
- bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows 7 VHD"
- bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast
Create entry for Grub4dos
The following example uses device boot - this can be changed to device partition=#:. You will need to copy grldr.mbr to the device specified. You will then need to copy grldr and menu.lst to any supported partition (FAT/NTFS/EXT2/3).- bcdedit.exe /store C:\Boot\BCD /create /application bootsector
- bcdedit.exe /store C:\Boot\BCD /set {guid} device boot
- bcdedit.exe /store C:\Boot\BCD /set {guid} path \grldr.mbr
- bcdedit.exe /store C:\Boot\BCD /set {guid} description "Grub4dos"
- bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast
Create {ramdiskoptions} entry
As far as I am aware {ramdiskoptions} is only used in order to boot a Windows Vista/2008/7 based WinPE. {ramdiskoptions} is used to identify the .sdi file required during the initial stages of booting WinPE.Due to a bug any subsequent WinPE based objects do not display their own descriptions if a {ramdiskoptions} description has been set. Do not therefore specify any description for {ramdiskoptions} - thanks to boot-land forum member cdob for this tip (see here).
The following example uses device boot - this can be changed to device partition=#: if required. Edit the ramdisksdipath path as required.
- bcdedit.exe /store C:\Boot\BCD /create {ramdiskoptions}
- bcdedit.exe /store C:\Boot\BCD /set {ramdiskoptions} ramdisksdidevice boot
- bcdedit.exe /store C:\Boot\BCD /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
Create entry for WinPE
A {ramdiskoptions} object must exist before creating an entry for WinPE. The following example uses device ramdisk=[boot] - this can be changed to device ramdisk=[#:] if required. Edit the description and device path as required.- bcdedit.exe /store C:\Boot\BCD /create /application osloader
- bcdedit.exe /store C:\Boot\BCD /set {guid} systemroot \Windows
- bcdedit.exe /store C:\Boot\BCD /set {guid} detecthal Yes
- bcdedit.exe /store C:\Boot\BCD /set {guid} winpe Yes
- bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}
- bcdedit.exe /store C:\Boot\BCD /set {guid} device ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}
- bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows PE"
- bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast
Using multiple {ramdiskoptions}
Thanks to boot-land forum member cdob for this tip (see here).Although only one {ramdiskoptions} object can be created it is possible to use a different .sdi file to the one specifed in {ramdiskoptions} ramdisksdipath by using the following workaround. At present I have not found any real use for implementing this however, as cdob points out, it may be necessary in future.
- bcdedit.exe /store C:\Boot\BCD /create /device
- bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdidevice partition=C:
- bcdedit.exe /store C:\Boot\BCD /set {ramdisk_guid} ramdisksdipath \Boot\different.sdi
- bcdedit.exe /store C:\Boot\BCD /create /application osloader
- bcdedit.exe /store C:\Boot\BCD /set {guid} systemroot \Windows
- bcdedit.exe /store C:\Boot\BCD /set {guid} detecthal Yes
- bcdedit.exe /store C:\Boot\BCD /set {guid} winpe Yes
- bcdedit.exe /store C:\Boot\BCD /set {guid} osdevice ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
- bcdedit.exe /store C:\Boot\BCD /set {guid} device ramdisk=[C:]\Sources\boot.wim,{ramdisk_guid}
- bcdedit.exe /store C:\Boot\BCD /set {guid} description "Windows PE"
- bcdedit.exe /store C:\Boot\BCD /displayorder {guid} /addlast
Source:http://diddy.boot-land.net/bcdedit/files/examples1.htm#new
ReplyDelete