{"id":1115,"date":"2014-04-26T15:54:15","date_gmt":"2014-04-26T13:54:15","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=1115"},"modified":"2014-04-27T15:15:57","modified_gmt":"2014-04-27T13:15:57","slug":"bcdedit-batch","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=1115","title":{"rendered":"bcdedit batch"},"content":{"rendered":"<p>More than once did I spend (lose&#8230;) long minutes on google to find the proper syntax with windows bcdedit command line.<\/p>\n<p>I came with the quick batch below that will set different entries : win7, winpe, grub4dos, etc &#8230;<\/p>\n<p>You need to edit the batch to set the path to your BCD store.<\/p>\n<p>Beware that the BCD is overwritten each time.<\/p>\n<p>Note that this is greatly (mostly) inspired from <a href=\"http:\/\/diddy.boot-land.net\/bcdedit\/files\/examples1.htm#new\" target=\"_blank\">this page<\/a>.<\/p>\n<p><code><br \/>\n@echo off<br \/>\nsetlocal<br \/>\nset BCDEDIT=%SYSTEMROOT%\\system32\\bcdedit.exe<br \/>\nset BCDSTORE=C:\\temp\\BCD<\/p>\n<p>del %BCDSTORE% \/F<\/p>\n<p>rem create - rem if not needed<br \/>\n%BCDEDIT% \/createstore %BCDSTORE% <\/p>\n<p>rem create bootmgr entry<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/create {bootmgr}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} description \"Boot Manager\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} device boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} timeout 20<\/p>\n<p>ECHO _________________________________________<br \/>\nECHO BCDEDIT Main Menu<br \/>\nECHO.<br \/>\nECHO   Menu Choices<br \/>\nECHO.<br \/>\nECHO 1 Add Win7<br \/>\nECHO 2 Add VHDBOOT<br \/>\nECHO 3 Add Grub4Dos<br \/>\nECHO 4 Add Winpe<br \/>\nECHO 5 Add RamDisk<br \/>\nECHO 6 Add NTLDR<br \/>\necho -<br \/>\nECHO 9 Exit<br \/>\nECHO _________________________________________<br \/>\nECHO.<br \/>\nSET \/P userChoice=ENTER OPTION:<\/p>\n<p>if %userChoice% == 1 GOTO win7<br \/>\nif %userChoice% == 2 GOTO vhdboot<br \/>\nif %userChoice% == 3 GOTO g4d<br \/>\nif %userChoice% == 4 GOTO winpe<br \/>\nif %userChoice% == 5 GOTO ramdisk<br \/>\nif %userChoice% == 6 GOTO ntdlr<br \/>\nif %userChoice% == 9 GOTO QUITMENU<\/p>\n<p>:win7<br \/>\nrem add new windows7 entry<br \/>\nfor \/f \"tokens=2 delims={}\" %%g in ('%BCDEDIT% \/store %BCDSTORE% \/create \/application osloader') do set guid={%%g}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% device partition=C:<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% path \\Windows\\system32\\winload.exe<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% osdevice partition=C:<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% systemroot \\Windows<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% description \"Windows 7\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder %guid% \/addlast<br \/>\ngoto :eof<\/p>\n<p>:ntdlr<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/create {ntldr}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {ntldr} device partition=C:<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {ntldr} path \\ntldr<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {ntldr} description \"Windows XP\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder {ntldr} \/addlast<br \/>\ngoto :eof<\/p>\n<p>:vhdboot<br \/>\nrem add new vhd boot entry<br \/>\nfor \/f \"tokens=2 delims={}\" %%g in ('%BCDEDIT% \/store %BCDSTORE% \/create \/application osloader') do set guid={%%g}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% device vhd=[C:]\\disk.vhd<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% path \\Windows\\system32\\winload.exe<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% osdevice vhd=[C:]\\disk.vhd<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% systemroot \\Windows<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% description \"Windows 7 VHDBOOT\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder %guid% \/addlast<br \/>\ngoto :eof<\/p>\n<p>:g4d<br \/>\nrem add grub4dos<br \/>\nfor \/f \"tokens=2 delims={}\" %%g in ('%BCDEDIT% \/store %BCDSTORE% \/create \/application osloader') do set guid={%%g}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% device boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% path \\grldr.mbr<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% description \"Grub4dos\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder %guid% \/addlast<br \/>\ngoto :eof<\/p>\n<p>:winpe<br \/>\nrem add winpe<br \/>\nfor \/f \"tokens=2 delims={}\" %%g in ('%BCDEDIT% \/store %BCDSTORE% \/create \/application osloader') do set guid={%%g}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% systemroot \\Windows<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% detecthal Yes<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% winpe Yes<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% osdevice ramdisk=[boot]\\Boot\\boot.wim,{ramdiskoptions}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% device ramdisk=[boot]\\Boot\\boot.wim,{ramdiskoptions}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% description \"Windows PE\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder %guid% \/addlast<br \/>\ngoto :eof<\/p>\n<p>:ramdisk<br \/>\nrem add ramdisk<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/create {ramdiskoptions}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {ramdiskoptions} ramdisksdidevice boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {ramdiskoptions} ramdisksdipath \\Boot\\boot.sdi<br \/>\ngoto :eof<\/p>\n<p>:eof<br \/>\necho \"this is the end...\"<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>More than once did I spend (lose&#8230;) long minutes on google to find the proper syntax with windows bcdedit command line. I came with the quick batch below that will set different entries : win7, winpe, grub4dos, etc &#8230; You need to edit the batch to set the path to your BCD store. Beware that <a href='https:\/\/labalec.fr\/erwan\/?p=1115' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1115","post","type-post","status-publish","format-standard","hentry","category-boot","category-16-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1115"}],"version-history":[{"count":2,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1115\/revisions"}],"predecessor-version":[{"id":1122,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1115\/revisions\/1122"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}