Jump to content











Photo
- - - - -

can I load grub4dos from boot.ini/ntldr from bcd?

bcd ntldr boot.ini

  • Please log in to reply
17 replies to this topic

#1 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 08 July 2013 - 11:11 PM

hi, I have always loaded gru4dos from boot.ini and now I am trying to load it from w7 bcd. is this possible? (not installed to mbr)

I think I need to edit bcd to load ntldr so boot.ini can point to grub4dos but I dont know the correct commands to do this or if it will work this way>

Ive held off using NT6/W7 as long as I can but now I am getting my feet wet.

what I am trying to do right now is run grub4dos from BCD without modify mbr. I looked in diddy's guide, it says install to mbr but I dont wanna.

can I start grub4dos from bcd without install? is there other alternate way like boot ntldr then grub4dos then w7 bcd?


thanks

#2 Motasem

Motasem

    Frequent Member

  • Advanced user
  • 169 posts
  • Interests:War Make's Men And Problems Make's You Expert
    MooT®
  •  
    Jordan

Posted 09 July 2013 - 12:05 AM

Plop boot manager ?

#3 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 09 July 2013 - 02:25 AM

/> />Plop boot manager ?

what?

#4 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 09 July 2013 - 05:22 AM

@Zoso

 

If you have Win7 and ntldr still exists, this entry is added automatically by bootmgr, no change in BCD is needed.

Then you got ntldr with boot.ini, inside it you have Grub4dos (syntax something like c:\grldr="Start grub4dos"),

then as answered in other thread you can boot Win7 VHD (or anything grub4dos can boot without being installed in MBR).



#5 joakim

joakim

    Silver Member

  • Team Reboot
  • 912 posts
  • Location:Bergen
  •  
    Norway

Posted 09 July 2013 - 07:29 AM

Try this; http://diddy.boot-la...s1.htm#grub4dos

 

Although I actually had another one in mind, but can't remember the exact command. Think it was "/application bootsector", but maybe it achieves the same thing..



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 09 July 2013 - 10:14 AM

@Zoso

 

If you have Win7 and ntldr still exists, this entry is added automatically by bootmgr, no change in BCD is needed.

Then you got ntldr with boot.ini, inside it you have Grub4dos (syntax something like c:\grldr="Start grub4dos"),

then as answered in other thread you can boot Win7 VHD (or anything grub4dos can boot without being installed in MBR).

No.

There is NO need for NTLDR.

BOOTMGR parses BOTH the \boot\BCD AND the BOOT.INI.

Of all the entries in the BOOT.INI, the ones containing an arcpath will be ignored BUT the ones called "legacy" i.e. pointing to a bootsector, of the kind:

 

 



C:\<somefile>="<some title>" 

 

like the typical grub4dos entry is:

 

 



C:\grldr="grub4dos"

this has been found out relatively recently, most guides/tutorials won't (yet) contain these info.

More:

http://reboot.pro/to...ddisk/?p=170654

 

:cheers:

Wonko



#7 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 09 July 2013 - 03:10 PM

if it is added automatically then I think I will follow spacesurfer's MSFN tutorial http://www.msfn.org/...mazing-concept/

if for some reason it doesnt work this way I think I have some good options now too. thanks guys! I will let you know.

#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 09 July 2013 - 03:19 PM

if it is added automatically then I think I will follow spacesurfer's MSFN tutorial http://www.msfn.org/...mazing-concept/

if for some reason it doesnt work this way I think I have some good options now too. thanks guys! I will let you know.

Yes/no.

"Native" VHD booting is "reserved" to the "high end" of licenses.

Namely:

http://reboot.pro/to...ds/#entry138494

 

/>
According to: http://technet.micro...ibrary/dd799282(v=ws.10).aspx#BKMK_limitations
It is restricted to Windows 7 Enterprise, Ultimate and Windows Server 2008 R2.


 

There are at least a couple of threads covering the matter:

http://reboot.pro/to...tive-boot-vhds/

http://reboot.pro/to...ot-os-from-vhd/

both "native" (for the licensed versions) and "non-native" (using grub4dos and then firadisk or winvblock), besides all the work by Wimb :thumbsup:, which - even if you don't use his tools - may be of use.

 

:cheers:

Wonko



#9 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 09 July 2013 - 04:06 PM

Yes/no.
"Native" VHD booting is "reserved" to the "high end" of licenses.
Namely:
http://reboot.pro/to...ds/#entry138494


There are at least a couple of threads covering the matter:
http://reboot.pro/to...tive-boot-vhds/
http://reboot.pro/to...ot-os-from-vhd/
both "native" (for the licensed versions) and "non-native" (using grub4dos and then firadisk or winvblock), besides all the work by Wimb :thumbsup:, which - even if you don't use his tools - may be of use.

:cheers:
Wonko

sambul61's threads here on the vhd subject are invaluable and easy to understand. this one http://reboot.pro/to...om-empty-drive/ is another one of his that is excellent!

wimb's tools are very good but not easy to understand, however in trying to understand them there is lots to be gained, Im working on that now too. basically trying to understand what his tools are doing and then use those steps manually so that I understand what and how.

as for the licensing, I am working with a trial version of embedded standard 7 IBW (Image Builder wizard) with it I can make 7 exactly how I want it small or larger than Ultimate or enterprise (with embeded functions)

thanks

#10 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 13 July 2013 - 02:34 PM

No.
There is NO need for NTLDR.
BOOTMGR parses BOTH the \boot\BCD AND the BOOT.INI.
Of all the entries in the BOOT.INI, the ones containing an arcpath will be ignored BUT the ones called "legacy" i.e. pointing to a bootsector, of the kind:

C:\<somefile>="<some title>"
like the typical grub4dos entry is:

C:\grldr="grub4dos"
this has been found out relatively recently, most guides/tutorials won't (yet) contain these info.
More:
http://reboot.pro/to...ddisk/?p=170654

:cheers:
Wonko
this is perfect solution so far! now trying to incorporate the floppy image method ktp suggested on the other thread: http://reboot.pro/to...em/#entry174553

#11 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 12 August 2013 - 04:50 PM

The BCD is easy to manipulate once you understand it.  You can boot most things from it, and if you use EasyBCD to do things like load an iso, you are just using a modified grldr.

 

My first example is an autoit script to copy grldr (this must be in the dir when compiled) to the c:\windows dir and then add a bcd entry.  The grldr should find a menu.lst in the usual locations.  I personally modify a copy of grldr to look for c:\windows\grub\menu.lst and during install i have a grub dir in $OEM$\$$\grub and run the below during firstlogon.cmd.  Must be compiled in x64 for x64.

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Grub4DOS.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker

#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <String.au3>
#include <Process.au3>

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; This disables 32bit applications from being redirected to syswow64 instead of system32 by default ;
If Not IsAdmin() Then
	RunAs($user, $domain, $pass, 0, @ScriptName, @ScriptDir)
EndIf


FileInstall("grldr", @WindowsDir & "\", 1)
;FileInstall("menu.lst", @WindowsDir & "\", 1)
;or
FileCopy(@ScriptDir & "\grldr", @WindowsDir & "\", 9)
FileCopy(@ScriptDir & "\menu.lst", @WindowsDir & "\", 9)

$bcdedit=@SystemDir & "\bcdedit.exe"

;Grub4dos
RunWait(@ComSpec & " /c " & $bcdedit & ' /create /d "Grub4dos" /application bootsector > ' & @TempDir & "\bcd_out.txt", @WindowsDir & "\system32", @SW_HIDE)
;Sleep(1000)
$3file = FileOpen(@TempDir & "\bcd_out.txt", 0)
$3line = FileReadLine($3file)
FileClose($3file)
$3pos1 = StringInStr($3line, "{")
$3pos2 = StringInStr($3line, "}")
If $3pos2 - $3pos1 = 37 Then
	$grub = StringMid($3line, $3pos1, $3pos2 - $3pos1 + 1)
	;Sleep(1000)
	RunWait(@ComSpec & " /c " & $bcdedit & " /set " & $grub & " device partition=c:", @WindowsDir & "\system32", @SW_HIDE)
	;Sleep(1000)
	RunWait(@ComSpec & " /c " & $bcdedit & " /set " & $grub & " path \windows\grldr", @WindowsDir & "\system32", @SW_HIDE)
	;Sleep(1000)
	RunWait(@ComSpec & " /c " & $bcdedit & " /displayorder " & $grub & " /addlast", @WindowsDir & "\system32", @SW_HIDE)
	;Sleep(1000)
	;RunWait(@ComSpec & " /c " & $bcdedit & ' Default {current}', @WindowsDir & "\system32", @SW_HIDE)
	;RunWait(@ComSpec & " /c " & $bcdedit & ' /set {current} bootmenupolicy standard', @WindowsDir & "\system32", @SW_HIDE)
	RunWait(@ComSpec & " /c " & $bcdedit & ' /timeout 10', @WindowsDir & "\system32", @SW_HIDE)
	FileDelete(@TempDir & "\bcd_out.txt")
EndIf
Exit

This is the same but cmd version and for a more standard location of grldr.  You also need this in each example for variables.

set BCD=%~dp0BCD
Set BCDEDIT=%SYSTEMROOT%\System32\BCDEDIT.exe
set PartitionLetter=c:

echo GRUB4DOS 
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub4dos" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast

This is for VHD

echo VHDDVD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast

Here is a cmd script to make a custom bcd from scratch.  Save this as a cmd and run it anywhere, as long as there isn't a bcd file in the same dir.  It should be easy enough to edit the names and paths, but tread lightly what you change.

 

The first is the big one i use, and the second one is a smaller one for MBR\BIOS DVD\USB only.

@echo off
rem http://diddy.boot-land.net/bcdedit/files/examples1.htm#winpe
rem for VMWARE   firmware= "efi"
title Windows V 7 8 install.wim boot.wim and BCD manipulation
:checkPrivileges 
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 
:getprivileges 
if '%1'=='ELEV' (shift & goto gotPrivileges)  
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" 
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" 
"%temp%\OEgetPrivileges.vbs" 
exit /B 
:gotPrivileges 

:STARTBCD
REM :::Choose variables here and below for :DVDMBR, :HDDMBR, :DVDEFI, and :HDDEFI
set BCD=%~dp0BCD
Set BCDEDIT=%SYSTEMROOT%\System32\BCDEDIT.exe
set PartitionLetter=x:

title Choose desired BCD 
cls
echo.
echo.
echo        Choose BCD type... 
echo.          
echo. 
echo   1 = DVD MBR (%BCD%) (Make custom BCD file)
echo.
echo   2 = HDD MBR (System) (Add entries to your system BCD)
echo. 
echo   3 = DVD EFI (%BCD%) (Make custom BCD file)
echo.
echo   4 = HDD EFI (System) (Add entries to your system BCD)
echo. 
echo   5 = DELETE Entry
echo   6 = RENAME BCD 
echo   7 = Change ORDER of BCD
echo   8 = Add Specific Entry to BCD
echo   9 = Add Win8 Safemode to system BCD (Must be logged in to Win8)
echo   10 = Boot Legacy (Win7)
echo   11 = Boot Standard (Win8)
echo   12 = Choose Deafult boot entry
echo.
echo   ** HDD Wim and VHD files Partition = %PartitionLetter%
echo.
echo. 
SET /P IM=Input number : 
SET DD=
If "%IM%"=="1" goto :DVDMBR
If "%IM%"=="2" goto :HDDMBR
If "%IM%"=="3" goto :DVDEFI
If "%IM%"=="4" goto :HDDEFI
If "%IM%"=="5" goto :DeleteBCD
If "%IM%"=="6" goto :RenameBCD
If "%IM%"=="7" goto :OrderBCD
If "%IM%"=="8" goto :AddBCD 
If "%IM%"=="9" goto :Win8Safemode
If "%IM%"=="10" goto :BootLegacy
If "%IM%"=="11" goto :BootStandard
If "%IM%"=="12" goto :DefaultBCD
If "%DD%"=="" echo INVALID NUMBER
If "%DD%"=="" goto :STARTBCD


:DVDMBR
set STORE=/store %BCD%
rem %BCDEDIT% /createstore %BCD%
set PartitionLetter=boot
set Partition=boot
set Path=[boot]\sources
set PathXPWIM=[boot]\boot
REM choice is for efi, leave blank for mbr
set choice=
set applicationpath=\Windows\system32\boot\winload.exe
set applicationpathHDD=\Windows\system32\winload.exe
set VHDname=VHD.vhd
set ramdisksdidevice=[boot]
set ramdisksdipath=\boot\boot.sdi
set bootmenupolicy=standard
set ramdisksdidevice=[boot]
set ramdisksdipath=\boot\boot.sdi
set DisplayBootMenu=%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
set memtest=\boot\memtest.exe
goto :CREATECUSTOMDVD%choice%

:HDDMBR
set STORE=
set Partition=partition=%PartitionLetter%
set Path=[%PartitionLetter%]\sources
REM choice is for efi, leave blank for mbr
set choice=
set applicationpath=\Windows\system32\winload.exe
set applicationpathHDD=\Windows\system32\winload.exe
set VHDname=VHD.vhd
set ramdisksdidevice=partition=c:
set ramdisksdipath=\Windows\system32\boot.sdi
set DisplayBootMenu=%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu False
set memtest=\Windows\Boot\PCAT\memtest.exe
%BCDEDIT% /set {current} bootmenupolicy standard
goto :CREATECUSTOMHDD%choice%

:DVDEFI
set STORE=/store %BCD%
set PartitionLetter=boot
set Partition=boot
set Path=[boot]\sources
REM choice is for efi, leave blank for mbr
set choice=EFI
set applicationpath=\Windows\system32\boot\winload.efi
set applicationpathHDD=\Windows\system32\winload.efi
set VHDname=VHD.vhd
set bootmenupolicy=standard
set ramdisksdidevice=[boot]
set ramdisksdipath=\boot\boot.sdi
set DisplayBootMenu=%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
set memtest=\efi\microsoft\boot\memtest.efi
goto :CREATECUSTOMDVD%choice%

:HDDEFI
set STORE=
set Partition=partition=%PartitionLetter%
set Path=[%PartitionLetter%]\sources
REM choice is for efi, leave blank for mbr
set choice=EFI
set applicationpath=\Windows\system32\winload.efi
set applicationpathHDD=\Windows\system32\winload.efi
set VHDname=VHD.vhd
set ramdisksdidevice=partition=c:
set ramdisksdipath=\Windows\system32\boot.sdi
set DisplayBootMenu=%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu False
set memtest=\Windows\Boot\EFI\memtest.efi
%BCDEDIT% /set {current} bootmenupolicy standard
goto :CREATECUSTOMHDD%choice%


:CREATECUSTOMDVD
call :CREATEBCD
call :Ramdisk
rem call :RamdiskHDD
call :WIM_bootwim
call :GRUB4DOS 
call :GRUB2
rem call :BURG
call :SYSLINUX
call :ISOLINUX
rem call :WIMBOOT_w8x86
rem call :WIMBOOT_w8x64
rem call :WIMBOOT_w7x86
rem call :WIMBOOT_w7x64
call :WIM_w8x86
call :WIM_w8x64
call :WIM_w7x86
call :WIM_w7x64
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
rem call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call ::WIM7
rem call ::WIM8
call :BCD_EXTRA
rem call :UBUNTU
rem call :BCD_UBUNTU
rem call :MEMTEST
rem call :BCD_PLOP
rem call :XPPE
call :XPntldrHDD
call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
rem call :VHDXDVD
rem call :VHDXHDD
rem call :VHDHDDw7x86
rem call :VHDHDDw7x64
rem call :VHDHDDw8x86
rem call :VHDHDDw8x64
rem call :pxelinux
rem call :pxeWindows
rem call :BootCdriveMBRDVD
rem call :BootCdriveEFIDVD
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :BootI
rem call :BootJ
rem call :BootK
%BCDEDIT% %STORE% /timeout 10
rem %BCDEDIT% %STORE% /enum
rem pause
goto :ORDERBCD
goto :StartBCD



:CREATECUSTOMHDD
rem bcdboot C:\Windows
rem call :CREATEBCD
rem call :BootC
call :RamdiskHDD
call :WIMBOOT_w8x86
rem call :WIMBOOT_w8x64
rem call :WIMBOOT_w7x86
rem call :WIMBOOT_w7x64
rem call :WIM_w8x86
call :WIM_w8x64
rem call :WIM_w7x86
rem call :WIM_w7x64
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
rem call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call ::WIM7
rem call ::WIM8
rem call :BCD_EXTRA
call :GRUB4DOS 
rem call :GRUB2
rem call :BURG
rem call :SYSLINUX
rem call :ISOLINUX
rem call :UBUNTU
rem call :BCD_UBUNTU
rem call :MEMTEST
rem call :BCD_PLOP
rem call :XPPE
rem call :XPntldrHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
rem call :VHDXDVD
rem call :VHDXHDD
rem call :VHDHDDw7x86
rem call :VHDHDDw7x64
rem call :VHDHDDw8x86
rem call :VHDHDDw8x64
rem call :pxelinux
rem call :pxeWindows
rem call :BootCdriveMBRDVD
rem call :BootCdriveEFIDVD
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :BootI
rem call :BootJ
rem call :BootK
%BCDEDIT% %STORE% /default {current}
%BCDEDIT% %STORE% /timeout 10
rem %BCDEDIT% %STORE% /enum
rem pause
goto :ORDERBCD
goto :StartBCD



:CREATECUSTOMDVDEFI
call :CREATEBCD
call :Ramdisk
rem call :RamdiskHDD
call :WIM_bootwim
rem call :GRUB4DOS 
rem call :GRUB2
rem call :BURG
rem call :SYSLINUX
rem call :ISOLINUX
rem call :WIMBOOT_w8x86
rem call :WIMBOOT_w8x64
rem call :WIMBOOT_w7x86
rem call :WIMBOOT_w7x64
call :WIM_w8x64
rem call :WIM_w7x86
call :WIM_w7x64
call :WIM_w8x86
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
rem call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call ::WIM7
rem call ::WIM8
rem call :BCD_EXTRA
rem call :UBUNTU
rem call :BCD_UBUNTU
rem call :MEMTEST
rem call :BCD_PLOP
rem call :XPPE
rem call :XPntldrHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
rem call :VHDXDVD
rem call :VHDXHDD
rem call :VHDHDDw7x86
rem call :VHDHDDw7x64
rem call :VHDHDDw8x86
rem call :VHDHDDw8x64
rem call :pxelinux
rem call :pxeWindows
rem call :BootCdriveMBRDVD
rem call :BootCdriveEFIDVD
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :BootI
rem call :BootJ
rem call :BootK
%BCDEDIT% %STORE% /timeout 10
rem %BCDEDIT% %STORE% /enum
rem pause
goto :ORDERBCD
goto :StartBCD



:CREATECUSTOMHDDEFI
rem bcdboot C:\Windows
rem call :CREATEBCD
rem call :BootC
call :RamdiskHDD
rem call :WIMBOOT_w8x86
call :WIMBOOT_w8x64
rem call :WIMBOOT_w7x86
rem call :WIMBOOT_w7x64
rem call :WIM_w8x86
rem call :WIM_w8x64
rem call :WIM_w7x86
rem call :WIM_w7x64
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
rem call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call ::WIM7
rem call ::WIM8
rem call :BCD_EXTRA
rem call :GRUB4DOS 
rem call :GRUB2
rem call :BURG
rem call :SYSLINUX
rem call :ISOLINUX
rem call :UBUNTU
rem call :BCD_UBUNTU
rem call :MEMTEST
rem call :BCD_PLOP
rem call :XPPE
rem call :XPntldrHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
rem call :VHDXDVD
rem call :VHDXHDD
rem call :VHDHDDw7x86
rem call :VHDHDDw7x64
rem call :VHDHDDw8x86
rem call :VHDHDDw8x64
rem call :pxelinux
rem call :pxeWindows
rem call :BootCdriveMBRDVD
rem call :BootCdriveEFIDVD
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :BootI
rem call :BootJ
rem call :BootK
%BCDEDIT% %STORE% /default {current}
%BCDEDIT% %STORE% /timeout 10
rem %BCDEDIT% %STORE% /enum
rem pause
goto :ORDERBCD
goto :StartBCD



:DELETEBCD 
echo. 
echo   1 = DVD (%BCD%)
echo.
echo   2 = HDD (System)
echo.
echo. 
SET /P IM=Input number : 
SET DD=
If "%IM%"=="1" goto :DVD
If "%IM%"=="2" goto :HDD
If "%DD%"=="" echo INVALID NUMBER
If "%DD%"=="" goto :STARTBCD

:DVD
set STORE=/store %BCD%
goto :DELETEBCD1

:HDD
set STORE=
goto :DELETEBCD1

:DELETEBCD1
set _count=1
for /f "tokens=1* usebackq skip=1" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (call :DELETEBCD2 %_count%)
:DELETEBCD2
if "%1" neq "" (set /a _count+=1 &for /f "tokens=1* usebackq skip=%_count%" %%c in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "description""`) do (echo            %_count%. %%d &goto :eof))
set _choice=
echo.
echo.
set /p _choice=Enter a number (Q to quit): 
echo.
echo.
if "%_choice%" equ "" goto :STARTBCD 
if "%_choice%" gtr "0" if %_choice% lss %_count% for /f "tokens=2 usebackq skip=%_choice%" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (%BCDEDIT% %STORE% /delete %%a /f &goto :DELETEBCD1)
goto :STARTBCD

:Win8Safemode
 %BCDEDIT% /copy {current} /d "Windows 8 (Safe Mode)"
 %BCDEDIT% /timeout 10 
 cls
  echo.
  echo.
  echo   Activate Win8 Safe Mode
  echo.
  echo.
set _count=1
for /f "tokens=1* usebackq skip=1" %%a in (`"%BCDEDIT% | c:\windows\system32\find "identifier""`) do (call :safemode %_count%)
:safemode  
if "%1" neq "" (set /a _count+=1 &for /f "tokens=1* usebackq skip=%_count%" %%c in (`"%BCDEDIT% | c:\windows\system32\find "description""`) do (echo            %_count%. %%d &goto :eof))
set _choice=
echo.
echo.
set /p _choice=Enter a number (Q to quit): 
echo.
echo.
if "%_choice%" equ "" goto :eof 
if "%_choice%" gtr "0" if %_choice% lss %_count% for /f "tokens=2 usebackq skip=%_choice%" %%a in (`"%BCDEDIT% | c:\windows\system32\find "identifier""`) do (%BCDEDIT% /set %%a safeboot minimal &goto :safemode2)
:safemode2
cd c:\windows\system32
reagentc /enable
 %BCDEDIT% /set {current} bootmenupolicy standard
 %BCDEDIT%
pause
goto :StartBCD

:CREATEBCD
Echo Create BCD
%BCDEDIT% /createstore %BCD%

Echo Create BootManager
%BCDEDIT% %STORE% /create {bootmgr}
%BCDEDIT% %STORE% /set {bootmgr} description "Windows Boot Manager"
%BCDEDIT% %STORE% /set {bootmgr} device %partition%
%BCDEDIT% %STORE% /set {bootmgr} locale en-US
%BCDEDIT% %STORE% /set {bootmgr} nointegritychecks YES
rem ***displaybootmenu disables win8 menu***
rem %BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
%DisplayBootMenu%
%BCDEDIT% %STORE% /timeout 10
Echo Bad memory
%BCDEDIT% %STORE% /create {badmemory}
Echo EMS
%BCDEDIT% %STORE% /create {emssettings}
rem text
rem %BCDEDIT% %STORE% /set {emssettings} bootems "Yes"
rem UI
%BCDEDIT% %STORE% /set {emssettings} bootems "No"
Echo Debug
%BCDEDIT% %STORE% /create {dbgsettings}
%BCDEDIT% %STORE% /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Echo Hypervisor
%BCDEDIT% %STORE% /create {hypervisorsettings}
%BCDEDIT% %STORE% /hypervisorsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Echo Global settings
%BCDEDIT% %STORE% /create {globalsettings}
%BCDEDIT% %STORE% /set {globalsettings} INHERIT {dbgsettings} {emssettings} {badmemory}
%BCDEDIT% %STORE% /set {bootmgr} INHERIT {globalsettings}
Echo Bootloader settings
%BCDEDIT% %STORE% /create {bootloadersettings}
%BCDEDIT% %STORE% /set {bootloadersettings} INHERIT {globalsettings} {hypervisorsettings}
Echo Resume
REM %BCDEDIT% %STORE% /create {resumeloadersettings}
REM %BCDEDIT% %STORE% /set {resumeloadersettings} INHERIT {globalsettings}
Echo Memtest
%BCDEDIT% %STORE% /create {memdiag}
%BCDEDIT% %STORE% /set {memdiag} description "Windows Memory Diagnostic"
rem %BCDEDIT% %STORE% /set {memdiag} device partition=\Device\HarddiskVolume1
%BCDEDIT% %STORE% /set {memdiag} device %partition%
%BCDEDIT% %STORE% /set {memdiag} path %memtest%
%BCDEDIT% %STORE% /set {memdiag} locale en-US
%BCDEDIT% %STORE% /set {memdiag} inherit {globalsettings}
REM %BCDEDIT% %STORE% /set {memdiag} badmemoryaccess Yes
%BCDEDIT% %STORE% /toolsdisplayorder {memdiag}
goto :eof


:Ramdisk
Echo Ramdisk settings
%BCDEDIT% %STORE% /create {ramdiskoptions}
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdidevice %partition%
rem %BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath %ramdisksdipath%
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi 
goto :eof

:RamdiskHDD
Echo Ramdisk settings
%BCDEDIT% %STORE% /create {ramdiskoptions}
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdidevice partition=c:
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath \Windows\system32\boot.sdi 
goto :eof



:BCD_EXTRA
echo BCD_EXTRA
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Extra Utilities" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\resources\BCD_EXTRA
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:UBUNTU
echo UBUNTU
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "UBUNTU (Needs Casper directory in root)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \casper\initrd.lz
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BCD_UBUNTU
echo BCD_UBUNTU
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "UBUNTU (Needs Casper directory in root)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\resources\BCD_UBUNTU
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BCD_PLOP
echo BCD_PLOP
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Plop" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\resources\BCD_PLOP
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:MEMTEST
echo MEMTEST 
%BCDEDIT% %STORE% /create {memdiag}
%BCDEDIT% %STORE% /set {memdiag} description "Windows Memory Diagnostic"
rem %BCDEDIT% %STORE% /set {memdiag} device partition=\Device\HarddiskVolume1
%BCDEDIT% %STORE% /set {memdiag} device %partition%
%BCDEDIT% %STORE% /set {memdiag} path %memtest%
rem %BCDEDIT% %STORE% /set {memdiag} locale en-US
rem %BCDEDIT% %STORE% /set {memdiag} inherit {globalsettings}
REM %BCDEDIT% %STORE% /set {memdiag} badmemoryaccess Yes
%BCDEDIT% %STORE% /toolsdisplayorder {memdiag}
%BCDEDIT% %STORE% /displayorder {memdiag} /addlast
goto :eof

:GRUB4DOS 
echo GRUB4DOS 
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub4dos" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr
rem %BCDEDIT% %STORE% /set %guid% path \grldr.mbr
rem %BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr.mbr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:GRUB2
echo GRUB2
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub2" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\g2ldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BURG
echo BURG
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Burg" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\burg\g2ldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:SYSLINUX
echo SYSLINUX
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Syslinux (USB)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\isolinux\syslinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:ISOLINUX
echo ISOLINUX 
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Isolinux (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\isolinux\isolinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPPE
echo XP PE
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Mini PE" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\SETUPLDR.BIN
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPntldrHDD
echo XP HDD
%BCDEDIT% %STORE% /create {ntldr} /d "WinXP {ntldr}"
%BCDEDIT% %STORE% /set {ntldr} device %partition%
%BCDEDIT% %STORE% /set {ntldr} path \ntldr
%BCDEDIT% %STORE% /displayorder {ntldr} /addlast
goto :eof

:XPNORMAL
echo XP normal
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP (SETUPLDR.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDR.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPADMIN
echo XP admin
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Admin (i386\SETUPLDU.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDU.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPES
echo XP Enter settings
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Enter Settings (i386\SETUPLDE.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDE.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:W2Go
echo Windows to go
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows to Go [boot] (Win8 Enterprise)"
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% osdevice %partition%
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDDVD
echo VHDDVD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDHDD
echo VHDHDD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDXDVD
echo VHDDVD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%x
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%x
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHDX (%Path%\%VHDname%x)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDXHDD
echo VHDHDD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%x
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%x
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHDX (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDHDDw7x86
echo VHDHDDw7x86
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w7x86.vhd
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w7x86.vhd
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w7x86 VHD (%Path%\w7x86.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDHDDw7x64
echo VHDHDDw7x64
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w7x64.vhd
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w7x64.vhd
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w7x64 VHD (%Path%\w7x64.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDHDDw8x86
echo VHDHDDw8x86
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w8x86.vhd
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w8x86.vhd
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w8x86 VHD (%Path%\w8x86.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDHDDw8x64
echo VHDHDDw8x64
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w8x64.vhd
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w8x64.vhd
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w8x64 VHD (%Path%\w8x64.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:pxelinux
echo pxelinux
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "pxelinux" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\syslinux\pxelinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:pxeWindows
echo pxeWindows
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "pxeboot.n12" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
REM %BCDEDIT% %STORE% /set %guid% path \boot\bootpxe\grldr
%BCDEDIT% %STORE% /set %guid% path \boot\bootpxe\pxeboot.n12
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BootCdriveMBRDVD
echo BootCdriveMBRDVD
set Drive=c:
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device partition=%Drive%
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\winload.exe
%BCDEDIT% %STORE% /set %guid% osdevice partition=%Drive%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows %Drive%"
%BCDEDIT% %STORE% /set %guid% bootmenupolicy %bootmenupolicy%
rem %BCDEDIT% %STORE% /set %guid% detecthal yes
%BCDEDIT% %STORE% /set %guid% nx optin
%BCDEDIT% %STORE% /set %guid% locale en-us
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BootCdriveEFIDVD
echo BootCdriveMBRDVD
set Drive=c:
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device partition=%Drive%
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\winload.efi
%BCDEDIT% %STORE% /set %guid% osdevice partition=%Drive%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows %Drive% %choice%"
%BCDEDIT% %STORE% /set %guid% bootmenupolicy %bootmenupolicy%
rem %BCDEDIT% %STORE% /set %guid% detecthal yes
%BCDEDIT% %STORE% /set %guid% nx optin
%BCDEDIT% %STORE% /set %guid% locale en-us
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BootC
echo Windows c:
set Drive=C:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootD
echo Windows D:
set Drive=D:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootE
echo Windows E:
set Drive=E:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootF
echo Windows F:
set Drive=F:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootG
echo Windows G:
set Drive=G:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootH
echo Windows H:
set Drive=H:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootI
echo Windows I:
set Drive=I:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootJ
echo Windows J:
set Drive=J:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootK
echo Windows K:
set Drive=K:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BOOT
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device partition=%Drive%
%BCDEDIT% %STORE% /set %guid% path %applicationpathHDD%
%BCDEDIT% %STORE% /set %guid% osdevice partition=%Drive%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows %choice% %Drive%"
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy %bootmenupolicy%
%BCDEDIT% %STORE% /set %guid% detecthal yes
%BCDEDIT% %STORE% /set %guid% nx optin
rem %BCDEDIT% %STORE% /set %guid% locale en-US
rem for bitlocker library_custom:0x17000077 set to 3   BcdLibraryIntegerList_AllowedInMemorySettings, i dunno...
rem %BCDEDIT% %STORE% /set %guid%  ems "yes"
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /set %guid2%  RecoveryOs true
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof



:WIM_bootwim
Echo boot.wim
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% systemroot \windows
%BCDEDIT% %STORE% /set %guid% detecthal yes
%BCDEDIT% %STORE% /set %guid% winpe yes
%BCDEDIT% %STORE% /set %guid% OSDEVICE ramdisk=%path%\boot.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid% DEVICE ramdisk=%path%\boot.wim,{ramdiskoptions} 
%BCDEDIT% %STORE% /set %guid% description "Windows %choice% (%path%\boot.wim)"
rem %BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% locale en-US
rem %BCDEDIT% %STORE% /set %guid% INHERIT {bootloadersettings}
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
rem %BCDEDIT% %STORE% /set %guid%  nx optin
rem %BCDEDIT% %STORE% /set %guid%  ems "no"
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /bootems %guid% on
%BCDEDIT% %STORE% /default %guid%  
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof



:WIM_DART_w7x86
echo Win DART 7 %choice% x86 
set pename="Win7 %choice% Setup\DART x86 (%path%\w7x86\boot.wim)"
set filena=%Path%\w7x86\boot.wim
goto :WIMAll
:WIM_DART_w7x64
echo Win DART 7 %choice% x64 
set pename="Win7 %choice% Setup\DART x64 (%path%\w7x64\boot.wim)"
set filena=%Path%\w7x64\boot.wim
goto :WIMAll
:WIM_DART_w8x86
echo Win DART 8 %choice% x86 
set pename="Win8 %choice% Setup\DART x86 (%path%\w8x86\boot.wim)"
set filena=%Path%\w8x86\boot.wim
goto :WIMAll
:WIM_DART_w8x64
echo Win DART 8 %choice% x64 
set pename="Win8 %choice% Setup\DART x64 (%path%\w8x64\boot.wim)"
set filena=%Path%\w8x64\boot.wim
goto :WIMAll
:WIM_DART_wVx86
echo Win DART Vista %choice% x86 
set pename="Vista %choice% Setup\DART x86 (%path%\wVx86\boot.wim)"
set filena=%Path%\wVx86\boot.wim
goto :WIMAll
:WIM_DART_wVx64
echo Win DART Vista x64 
set pename="Vista %choice% Setup\DART x64 (%path%\wVx64\boot.wim)"
set filena=%Path%\wVx64\boot.wim
goto :WIMAll
:WIM_w7x86
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% x86 (%path%\w7x86.wim)"
set filena=%Path%\w7x86.wim
goto :WIMAll
:WIM_w7x64
echo WinPE 7 %choice% x64
set pename="WinPE 7 %choice% x64 (%path%\w7x64.wim)"
set filena=%Path%\w7x64.wim
goto :WIMAll
:WIMBOOT_w7x86
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% x86 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMBOOT_w7x64
echo WinPE 7 %choice% x64
set pename="WinPE 7 %choice% x64 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM_w8x86
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% x86 (%path%\w8x86.wim)"
set filena=%Path%\w8x86.wim
goto :WIMAll
:WIM_w8x64
echo WinPE 8 %choice% x64
set pename="WinPE 8 %choice% x64 (%path%\w8x64.wim)"
set filena=%Path%\w8x64.wim
goto :WIMAll
:WIMBOOT_w8x86
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% x86 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMBOOT_w8x64
echo WinPE 8 %choice% x64
set pename="WinPE 8 %choice% x64 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM7
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% (%path%\Win7.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM8
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% (%path%\Win8.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMALL
rem create a new ramdisk where you can specify a different boot.sdi.  last entry here http://diddy.boot-land.net/bcdedit/files/examples1.htm#winpe
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /device') do set ramdisk=%%A 
rem %BCDEDIT% %STORE% /set %ramdisk% ramdisksdidevice %partition%
%BCDEDIT% %STORE% /set %ramdisk% ramdisksdidevice %ramdisksdidevice%
%BCDEDIT% %STORE% /set %ramdisk% ramdisksdipath %ramdisksdipath%

for /f "Tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set GUID=%%A
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% winpe Yes
%BCDEDIT% %STORE% /set %guid% osdevice ramdisk=%filena%,%ramdisk%
%BCDEDIT% %STORE% /set %guid% device ramdisk=%filena%,%ramdisk%
rem %BCDEDIT% %STORE% /set %guid% osdevice ramdisk=[x:]\Sources\boot.wim,%ramdisk%
rem %BCDEDIT% %STORE% /set %guid% device ramdisk=[x:]\Sources\boot.wim,%ramdisk%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% locale en-US
rem %BCDEDIT% %STORE% /set %guid% INHERIT {bootloadersettings}
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
rem %BCDEDIT% %STORE% /set %guid%  nx optin
rem %BCDEDIT% %STORE% /set %guid%  ems "no"
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /bootems %guid% on
rem %BCDEDIT% %STORE% /default %guid%  
%BCDEDIT% %STORE% /set %guid% description %pename%
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:ORDERBCD
rem pause
title Choose Order or quit
cls
%BCDEDIT% %STORE%
echo.  
echo   Ordering of items on the Boot Menu    
echo.        
set _count=1
for /f "tokens=1* usebackq skip=1" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (call :ORDERBCD1 %_count%)
:ORDERBCD1
if "%1" neq "" (set /a _count+=1 &for /f "tokens=1* usebackq skip=%_count%" %%c in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "description""`) do (echo            %_count%. %%d &goto :eof))
echo.
echo   Choose one you want to put into the first slot or exit
echo.
set _choice=
set /p _choice=Enter a number (Q to quit): 
if "%_choice%" equ "" goto :ORDERBCD
if "%_choice%" equ "q" goto :STARTbcd
if "%_choice%" gtr "0" if %_choice% lss %_count% for /f "tokens=2 usebackq skip=%_choice%" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (%BCDEDIT% %STORE% /displayorder %%a /addfirst &goto :STARTbcd)
%BCDEDIT% %STORE%
pause
goto :eof
:eof
@echo off
rem http://diddy.boot-land.net/bcdedit/files/examples1.htm#winpe
rem for VMWARE   firmware= "efi"
title Windows V 7 8 install.wim boot.wim and BCD manipulation
:checkPrivileges 
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 
:getprivileges 
if '%1'=='ELEV' (shift & goto gotPrivileges)  
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" 
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" 
"%temp%\OEgetPrivileges.vbs" 
exit /B 
:gotPrivileges 

:STARTBCD
REM :::Choose variables here and below for :DVDMBR, :HDDMBR, :DVDEFI, and :HDDEFI
set BCD=%~dp0BCD
Set BCDEDIT=%SYSTEMROOT%\System32\BCDEDIT.exe
set PartitionLetter=x:

set STORE=/store %BCD%
rem %BCDEDIT% /createstore %BCD%
set PartitionLetter=boot
set Partition=boot
set Path=[boot]\sources
set PathXPWIM=[boot]\boot
REM choice is for efi, leave blank for mbr
set choice=
set applicationpath=\Windows\system32\boot\winload.exe
set applicationpathHDD=\Windows\system32\winload.exe
set VHDname=VHD.vhd
set ramdisksdidevice=[boot]
set ramdisksdipath=\boot\boot.sdi
set bootmenupolicy=standard
set ramdisksdidevice=[boot]
set ramdisksdipath=\boot\boot.sdi
set DisplayBootMenu=%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
set memtest=\boot\memtest.exe
goto :CREATECUSTOMDVD

:CREATECUSTOMDVD
call :CREATEBCD
call :Ramdisk
call :WIM_bootwim
call :GRUB4DOS 
call :GRUB2
call :SYSLINUX
call :ISOLINUX
call :WIM_w8x86
call :WIM_w8x64
call :WIM_w7x86
call :WIM_w7x64
call :VHDDVD
call :XPntldrHDD
call :XPNORMAL
call :BCD_PLOP
call :UBUNTU
%BCDEDIT% %STORE% /timeout 10
call :ORDERBCD
goto :StartBCD


:CREATEBCD
Echo Create BCD
%BCDEDIT% /createstore %BCD%

Echo Create BootManager
%BCDEDIT% %STORE% /create {bootmgr}
%BCDEDIT% %STORE% /set {bootmgr} description "Windows Boot Manager"
%BCDEDIT% %STORE% /set {bootmgr} device %partition%
%BCDEDIT% %STORE% /set {bootmgr} locale en-US
%BCDEDIT% %STORE% /set {bootmgr} nointegritychecks YES
rem ***displaybootmenu disables win8 menu***
rem %BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
%DisplayBootMenu%
%BCDEDIT% %STORE% /timeout 10
Echo Bad memory
%BCDEDIT% %STORE% /create {badmemory}
Echo EMS
%BCDEDIT% %STORE% /create {emssettings}
rem text
rem %BCDEDIT% %STORE% /set {emssettings} bootems "Yes"
rem UI
%BCDEDIT% %STORE% /set {emssettings} bootems "No"
Echo Debug
%BCDEDIT% %STORE% /create {dbgsettings}
%BCDEDIT% %STORE% /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Echo Hypervisor
%BCDEDIT% %STORE% /create {hypervisorsettings}
%BCDEDIT% %STORE% /hypervisorsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Echo Global settings
%BCDEDIT% %STORE% /create {globalsettings}
%BCDEDIT% %STORE% /set {globalsettings} INHERIT {dbgsettings} {emssettings} {badmemory}
%BCDEDIT% %STORE% /set {bootmgr} INHERIT {globalsettings}
Echo Bootloader settings
%BCDEDIT% %STORE% /create {bootloadersettings}
%BCDEDIT% %STORE% /set {bootloadersettings} INHERIT {globalsettings} {hypervisorsettings}
Echo Resume
REM %BCDEDIT% %STORE% /create {resumeloadersettings}
REM %BCDEDIT% %STORE% /set {resumeloadersettings} INHERIT {globalsettings}
Echo Memtest
%BCDEDIT% %STORE% /create {memdiag}
%BCDEDIT% %STORE% /set {memdiag} description "Windows Memory Diagnostic"
rem %BCDEDIT% %STORE% /set {memdiag} device partition=\Device\HarddiskVolume1
%BCDEDIT% %STORE% /set {memdiag} device %partition%
%BCDEDIT% %STORE% /set {memdiag} path %memtest%
%BCDEDIT% %STORE% /set {memdiag} locale en-US
%BCDEDIT% %STORE% /set {memdiag} inherit {globalsettings}
REM %BCDEDIT% %STORE% /set {memdiag} badmemoryaccess Yes
%BCDEDIT% %STORE% /toolsdisplayorder {memdiag}
goto :eof


:Ramdisk
Echo Ramdisk settings
%BCDEDIT% %STORE% /create {ramdiskoptions}
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdidevice %partition%
rem %BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath %ramdisksdipath%
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi 
goto :eof


:UBUNTU
echo UBUNTU
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "UBUNTU (Needs Casper directory in root)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \casper\initrd.lz
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:BCD_PLOP
echo BCD_PLOP
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Plop" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\resources\BCD_PLOP
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:GRUB4DOS 
echo GRUB4DOS 
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub4dos" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr
rem %BCDEDIT% %STORE% /set %guid% path \grldr.mbr
rem %BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr.mbr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:GRUB2
echo GRUB2
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub2" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\g2ldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:SYSLINUX
echo SYSLINUX
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Syslinux (USB)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\isolinux\syslinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:ISOLINUX
echo ISOLINUX 
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Isolinux (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\isolinux\isolinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPPE
echo XP PE
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Mini PE" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\SETUPLDR.BIN
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:XPntldrHDD
echo XP HDD
%BCDEDIT% %STORE% /create {ntldr} /d "WinXP {ntldr}"
%BCDEDIT% %STORE% /set {ntldr} device %partition%
%BCDEDIT% %STORE% /set {ntldr} path \ntldr
%BCDEDIT% %STORE% /displayorder {ntldr} /addlast
goto :eof

:XPNORMAL
echo XP normal
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP (SETUPLDR.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDR.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:VHDDVD
echo VHDDVD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
rem %BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:WIM_bootwim
Echo boot.wim
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% systemroot \windows
%BCDEDIT% %STORE% /set %guid% detecthal yes
%BCDEDIT% %STORE% /set %guid% winpe yes
%BCDEDIT% %STORE% /set %guid% OSDEVICE ramdisk=%path%\boot.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid% DEVICE ramdisk=%path%\boot.wim,{ramdiskoptions} 
%BCDEDIT% %STORE% /set %guid% description "Windows %choice% (%path%\boot.wim)"
rem %BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% locale en-US
rem %BCDEDIT% %STORE% /set %guid% INHERIT {bootloadersettings}
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
rem %BCDEDIT% %STORE% /set %guid%  nx optin
rem %BCDEDIT% %STORE% /set %guid%  ems "no"
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /bootems %guid% on
%BCDEDIT% %STORE% /default %guid%  
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:WIM_DART_w7x86
echo Win DART 7 %choice% x86 
set pename="Win7 %choice% Setup\DART x86 (%path%\w7x86\boot.wim)"
set filena=%Path%\w7x86\boot.wim
goto :WIMAll
:WIM_DART_w7x64
echo Win DART 7 %choice% x64 
set pename="Win7 %choice% Setup\DART x64 (%path%\w7x64\boot.wim)"
set filena=%Path%\w7x64\boot.wim
goto :WIMAll
:WIM_DART_w8x86
echo Win DART 8 %choice% x86 
set pename="Win8 %choice% Setup\DART x86 (%path%\w8x86\boot.wim)"
set filena=%Path%\w8x86\boot.wim
goto :WIMAll
:WIM_DART_w8x64
echo Win DART 8 %choice% x64 
set pename="Win8 %choice% Setup\DART x64 (%path%\w8x64\boot.wim)"
set filena=%Path%\w8x64\boot.wim
goto :WIMAll
:WIM_DART_wVx86
echo Win DART Vista %choice% x86 
set pename="Vista %choice% Setup\DART x86 (%path%\wVx86\boot.wim)"
set filena=%Path%\wVx86\boot.wim
goto :WIMAll
:WIM_DART_wVx64
echo Win DART Vista x64 
set pename="Vista %choice% Setup\DART x64 (%path%\wVx64\boot.wim)"
set filena=%Path%\wVx64\boot.wim
goto :WIMAll
:WIM_w7x86
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% x86 (%path%\w7x86.wim)"
set filena=%Path%\w7x86.wim
goto :WIMAll
:WIM_w7x64
echo WinPE 7 %choice% x64
set pename="WinPE 7 %choice% x64 (%path%\w7x64.wim)"
set filena=%Path%\w7x64.wim
goto :WIMAll
:WIMBOOT_w7x86
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% x86 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMBOOT_w7x64
echo WinPE 7 %choice% x64
set pename="WinPE 7 %choice% x64 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM_w8x86
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% x86 (%path%\w8x86.wim)"
set filena=%Path%\w8x86.wim
goto :WIMAll
:WIM_w8x64
echo WinPE 8 %choice% x64
set pename="WinPE 8 %choice% x64 (%path%\w8x64.wim)"
set filena=%Path%\w8x64.wim
goto :WIMAll
:WIMBOOT_w8x86
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% x86 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMBOOT_w8x64
echo WinPE 8 %choice% x64
set pename="WinPE 8 %choice% x64 (%path%\boot.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM7
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% (%path%\Win7.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIM8
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% (%path%\Win8.wim)"
set filena=%Path%\boot.wim
goto :WIMAll
:WIMALL
rem create a new ramdisk where you can specify a different boot.sdi.  last entry here http://diddy.boot-land.net/bcdedit/files/examples1.htm#winpe
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /device') do set ramdisk=%%A 
rem %BCDEDIT% %STORE% /set %ramdisk% ramdisksdidevice %partition%
%BCDEDIT% %STORE% /set %ramdisk% ramdisksdidevice %ramdisksdidevice%
%BCDEDIT% %STORE% /set %ramdisk% ramdisksdipath %ramdisksdipath%

for /f "Tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set GUID=%%A
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% winpe Yes
%BCDEDIT% %STORE% /set %guid% osdevice ramdisk=%filena%,%ramdisk%
%BCDEDIT% %STORE% /set %guid% device ramdisk=%filena%,%ramdisk%
rem %BCDEDIT% %STORE% /set %guid% osdevice ramdisk=[x:]\Sources\boot.wim,%ramdisk%
rem %BCDEDIT% %STORE% /set %guid% device ramdisk=[x:]\Sources\boot.wim,%ramdisk%
%BCDEDIT% %STORE% /set %guid% path %applicationpath%
%BCDEDIT% %STORE% /set %guid% locale en-US
rem %BCDEDIT% %STORE% /set %guid% INHERIT {bootloadersettings}
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
rem %BCDEDIT% %STORE% /set %guid%  nx optin
rem %BCDEDIT% %STORE% /set %guid%  ems "no"
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /bootems %guid% on
rem %BCDEDIT% %STORE% /default %guid%  
%BCDEDIT% %STORE% /set %guid% description %pename%
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof

:ORDERBCD
rem pause
title Choose Order or quit
cls
%BCDEDIT% %STORE%
echo.  
echo   Ordering of items on the Boot Menu    
echo.        
set _count=1
for /f "tokens=1* usebackq skip=1" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (call :ORDERBCD1 %_count%)
:ORDERBCD1
if "%1" neq "" (set /a _count+=1 &for /f "tokens=1* usebackq skip=%_count%" %%c in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "description""`) do (echo            %_count%. %%d &goto :eof))
echo.
echo   Choose one you want to put into the first slot or exit
echo.
set _choice=
set /p _choice=Enter a number (Q to quit): 
if "%_choice%" equ "" goto :ORDERBCD
if "%_choice%" equ "q" goto :STARTbcd
if "%_choice%" gtr "0" if %_choice% lss %_count% for /f "tokens=2 usebackq skip=%_choice%" %%a in (`"%BCDEDIT% %STORE% | c:\windows\system32\find "identifier""`) do (%BCDEDIT% %STORE% /displayorder %%a /addfirst &goto :STARTbcd)
%BCDEDIT% %STORE%
pause
goto :eof
:eof

Edited by halikus, 12 August 2013 - 05:01 PM.


#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 August 2013 - 05:01 PM

@halikus

Can you please also save those files into a .zip or .7z and attach the archive?

Due to the several issues in the past with board parser when it comes to QUOTE or CODE tags, better be safe than sorry, IMHO. :)

 

:cheers:

Wonko



#13 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 12 August 2013 - 05:19 PM

Sure.  And i know what you mean about the code tags.  On of the big hurdles i had with grub4dos originally was all the HDD code was messed up like %"~HD0;*A~ and it took me awhile to realize it was just poor forum formatting.  :)

 

I did copy and paste the above into cmd and it seemed to work, but heres The main cmd i use and a smaller MBR DVD only version.  After setting your initial partition for the payloads (on DVD it should default to [boot]) and edit wich entries it calls ie:

call :ISOLINUX
rem call :WIMBOOT_w8x86

 

will add isolinux but not the x86 wim.

 

I have tried this script on various systems and it works.  I wouldn't release it if it didn't as it can be dangerous.  If it should however mess up your BCD, don't blame me :)  Making a DVD MBR or EFI BCD is 100% harmless and should be copied to \boot\BCD afterwards.  Adding to your systems BCD should just add entries you select.  I use the system32 boot.sdi, so there is no reason to copy it anywhere with HDD wim and VHD entries.

 

Edit, i can't for the life of me figure out how to attach files.  I see the My Media tab, but it won't let me do anything.

 

Heres a 2shared link.  Its 139kb so if that doesn't work, pick a file share www and i'll oblige.

http://www.2shared.c...1np4ad/BCD.html

Attached Files

  • Attached File  BCD.7z   138.47KB   544 downloads

Edited by Wonko the Sane, 12 August 2013 - 06:29 PM.


#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 August 2013 - 06:33 PM

I took the liberty to download the file and attach it to your post (I thought that there were issues with the recent board crash, but seemingly it worked fine - or at least the same way it has always worked, maybe you are not - yet - authorized to attach files? If this is the case send an e-mail to Nuno and he may give you the privilege).

 

Just as a reminder, for some of the CODE that was botched by the wrong parsing of the board, this has been useful in the past:

http://reboot.pro/to...code-converter/

http://pastehtml.com.../b4t99xk89.html

;)

 

:cheers:

Wonko



#15 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 12 August 2013 - 06:44 PM

Thanks.  I also added an autoit "winPE.au3" that will scan all drives for sources\boot.wim, will copy it to c:\windows\boot.wim, and then adds a BCD entry whether it found boot.wim or not, so you can manually copy one to c:\windows.  Must be compiled in x64 for x64 machines.  Also, after a re-install, the boot entries remain, but obviously any files you added to c:\windows will be missing after a fresh install.

 

I was always more familiar with Windows than Linux, so the BCD made more sense to me.  It can do most things i try except running bat\cmd scripts and booting isos.  Its a "if you can't beat them, join them" mentality.  I find most of my friends and clients use Windows as their main bootloader, but its nice to add the added flexibility of grub4dos to cover any Linux ventures and an emergency WinPE for disaster recovery.  I hide them in the Windows dir so people don't notice them.


Edited by halikus, 12 August 2013 - 06:47 PM.


#16 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 12 August 2013 - 11:15 PM

whoa! that looks very useful but Im going to have to re-read it a few times to try an understand it. thanks halikus

#17 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 13 August 2013 - 12:54 AM

This is the most simplistic cmd example per your OP, how to add G4D to a system BCD.  The other scripts are possibly overwhelming because of the slight differences needed for EFI vs BIOS, HDD vs DVD, labelling the entries, etc.   This is as straight forward as a BCD cmd can get.   Edit the "path" and "device" accordingly.  For DVD, "device" MUST be "[boot]" and you must add the location of the BCD store target.. 

The "for /f tokens" creates the entry and gets the gui id, and then carries the variable over to the rest of the nessessary entries.

@echo off
Set BCDEDIT=%SYSTEMROOT%\System32\BCDEDIT.exe
echo GRUB4DOS 
for /f "tokens=3" %%A in ('%BCDEDIT% %~dp0BCD /create /d "Grub4dos" /application bootsector') do set guid=%%A
%BCDEDIT% /set %guid% device c:
%BCDEDIT% /set %guid% path \boot\grub\grldr
rem %BCDEDIT% /set %guid% path \boot\grub\grldr.mbr
%BCDEDIT% /displayorder %guid% /addlast
%BCDEDIT%
pause


#18 halikus

halikus

    Frequent Member

  • Advanced user
  • 110 posts
  •  
    Canada

Posted 13 August 2013 - 01:14 AM

Totally off topic, but if you can reverse engineer the above script, this is what i use to integrate ms updates in wim files.  Assuming you have the right source files and directories, it will take an all in one win7 and 8 x86 and x64 install.wim and install the proper MSU files.  You will be missing files and such, so don't expect results the way it is, but its a "pretty darn good" method. :)

@echo off
rem for VMWARE if you want to test EFI, add to second line of vmx:  firmware= "efi"
title Windows 7 and 8 AIO install.wim and Updates
rem This makes sure you run as admin
:checkPrivileges 
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 
:getprivileges 
if '%1'=='ELEV' (shift & goto gotPrivileges)  
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" 
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" 
"%temp%\OEgetPrivileges.vbs" 
exit /B 
:gotPrivileges 
rem End of Run as admin
for /f "tokens=1-4 delims=/ " %%a in ('Date /t') do (
set Month=%%b
rem set Day=%%c
set Year=%%d
)
set creationdate=%Month%-%Year%
set Dism=c:\Windows\system32\Dism.exe
set mount=%systemdrive%\mount
Echo.
Echo     ****Cleanup Wims from previous run****
Echo.
IF EXIST %mount% echo %Dism% /UNMOUNT-WIM /MOUNTDIR:%mount% /discard
%Dism% -cleanup-wim
rmdir /s /q %mount%
IF EXIST %mount% echo %mount% folder still appears to be in use.  Try re-running this script or a reboot. & Pause
cls
rem pause

:START
rem set global variables between here and line 126

set imagex=c:\Windows\system32\imagex.exe
IF NOT EXIST %imagex% echo No %imagex% found! Please add manually from WAIK. & Pause
rem The name of the wim you wish to update.  Default is %~dp0install.wim.  DO NOT USE install2.wim
set WimSource=%~dp0install.wim
rem Win8 Optional App Associations  Example:  %~dp0AppAssoc.xml
set AppAssoc=%~dp0AppAssoc.xml
rem Win8 Optional Add Net3 Needs sources\sxs  Example: %~dp0w8x86\sources\sxs
set Win8x86sxs=%~dp0@OS\w8x86\sources\sxs
set Win8x64sxs=%~dp0@OS\w8x64\sources\sxs

rem Set source wims
rem set Win8 Pro
set w8Px86=%~dp0w8MAIN.wim
set INDEXw8Px86=1
set w8Px64=%~dp0w8MAIN.wim
set INDEXw8Px64=2
rem set Win8 WMC
set w8WMCx86=
set INDEXw8WMCx86=3
set w8WMCx64=
set INDEXw8WMCx64=4
rem set Win8 Enterprise
set w8Ex86=%~dp0w8MAIN.wim
set INDEXw8Ex86=5
set w8Ex64=%~dp0w8MAIN.wim
set INDEXw8Ex64=6
rem set Win8 Core
set w8Cx86=
set INDEXw8Cx86=7
set w8Cx64=
set INDEXw8Cx64=8
rem set Win8 CoreSL
set w8CSLx64=%~dp0w8MAIN.wim
set INDEXw8CSLx64=9

rem set Win7
set w7Ux86=%~dp0w7MAIN.wim
set INDEXw7Ux86=1
set w7Ux64=%~dp0w7MAIN.wim
set INDEXw7Ux64=2
rem set Win7 Enterprise
set w7Ex86=
set INDEXw7Ex86=3
set w7Ex64=
set INDEXw7Ex64=4
rem set Win7 Professional
set w7Px86=
set INDEXw7Px86=5
set w7Px64=
set INDEXw7Px64=6
rem set Win7 Home Premium
set w7HPx86=
set INDEXw7HPx86=7
set w7HPx64=
set INDEXw7HPx64=8
rem set Win7 Home Basic
set w7HBx86=
set INDEXw7HBx86=9
set w7HBx64=
set INDEXw7HBx64=10
rem set Win7 Starter
set w7Sx86=
set INDEXw7Sx86=11





set update=%~dp0UPDATES
rem set Win8 Update dirs %update%\Windows %OS% %ARCH%\
set Update81=Additional\NET35
set Update82=Main Updates\WU_Satisfy
set Update83=Main Updates
set Update84=Additional\Integrate to installation media
set Update85=Additional\Camera Codec Pack
set Update86=
set Update87=
set Update88=
set Update89=
set Update810=

rem set Win7 Update dirs %update%\Windows %OS% %ARCH%\
set Update71=Additional\IE10\Prerequisites
set Update72=Additional\IE10
set Update73=Main Updates\WU_Satisfy
set Update74=Main Updates
set Update75=Additional\IE10\Updates
set Update76=
set Update77=
set Update78=
set Update79=
set Update710=

rem Don't change anything below here

rem export the wims you want from your base wim
rem 8 pro 
IF EXIST %w8Px86% echo title Exporting | %imagex% /compress maximum /export %w8Px86% %INDEXw8Px86% %WimSource%
IF EXIST %w8Px64% echo title Exporting | %imagex% /compress maximum /export %w8Px64% %INDEXw8Px64% %WimSource%
rem 8 WMC 
IF EXIST %w8WMCx86% echo title Exporting | %imagex% /compress maximum /export %w8WMCx86% %INDEXw8WMCx86% %WimSource%
IF EXIST %w8WMCx64% echo title Exporting | %imagex% /compress maximum /export %w8WMCx64% %INDEXw8WMCx64% %WimSource%
rem 8 enterprise 
IF EXIST %w8Ex86% echo title Exporting | %imagex% /compress maximum /export %w8Ex86% %INDEXw8Ex86% %WimSource%
IF EXIST %w8Ex64% echo title Exporting | %imagex% /compress maximum /export %w8Ex64% %INDEXw8Ex64% %WimSource%
rem 8 Core
IF EXIST %w8Cx86% echo title Exporting | %imagex% /compress maximum /export %w8Cx86% %INDEXw8Cx86% %WimSource%
IF EXIST %w8Cx64% echo title Exporting | %imagex% /compress maximum /export %w8Cx64% %INDEXw8Cx64% %WimSource%
rem 8 Core Single Language
IF EXIST %w8CSLx64% echo title Exporting | %imagex% /compress maximum /export %w8CSLx64% %INDEXw8CSLx64% %WimSource%

rem 7 ultimate
IF EXIST %w7Ux86% echo title Exporting | %imagex% /compress maximum /export %w7Ux86% %INDEXw7Ux86% %WimSource%
IF EXIST %w7Ux64% echo title Exporting | %imagex% /compress maximum /export %w7Ux64% %INDEXw7Ux64% %WimSource%
rem 7 Enterprise
IF EXIST %w7Ex86% echo title Exporting | %imagex% /compress maximum /export %w7Ex86% %INDEXw7Ex86% %WimSource%
IF EXIST %w7Ex64% echo title Exporting | %imagex% /compress maximum /export %w7Ex64% %INDEXw7Ex64% %WimSource%
rem 7 Professional
IF EXIST %w7Px86% echo title Exporting | %imagex% /compress maximum /export %w7Px86% %INDEXw7Px86% %WimSource%
IF EXIST %w7Px64% echo title Exporting | %imagex% /compress maximum /export %w7Px64% %INDEXw7Px64% %WimSource%
rem 7 Home Premium
IF EXIST %w7HPx86% echo title Exporting | %imagex% /compress maximum /export %w7HPx86% %INDEXw7HPx86% %WimSource%
IF EXIST %w7HPx64% echo title Exporting | %imagex% /compress maximum /export %w7HPx64% %INDEXw7HPx64% %WimSource%
rem 7 Home Basic
IF EXIST %w7HBx86% echo title Exporting | %imagex% /compress maximum /export %w7HBx86% %INDEXw7HBx86% %WimSource%
IF EXIST %w7HBx64% echo title Exporting | %imagex% /compress maximum /export %w7HBx64% %INDEXw7HBx64% %WimSource%
rem 7 Starter
IF EXIST %w7Sx86% echo title Exporting | %imagex% /compress maximum /export %w7Sx86% %INDEXw7Sx86% %WimSource%



IF NOT EXIST %~dp0install.wim echo No %~dp0Install.wim found! & Pause
IF NOT EXIST %update% echo No %update% MS MSU Updates folder found! & Pause
rem %imagex% /XML /info %WimSource% & ping -n 5 127.0.0.1 > nul
%Dism% /Get-WimInfo /WimFile:%WimSource% & ping -n 5 127.0.0.1 > nul
Echo.
Echo            These are whats going to update.  Starting...
Echo.
Echo.
set index=1
call :UPDATES
set index=2
call :UPDATES
set index=3
call :UPDATES
set index=4
call :UPDATES
set index=5
call :UPDATES
set index=6
call :UPDATES
set index=7
call :UPDATES
set index=8
call :UPDATES
set index=9
call :UPDATES
set index=10
call :UPDATES
set index=11
call :UPDATES
set index=12
call :UPDATES
set index=13
call :UPDATES
set index=14
call :UPDATES
set index=15
call :UPDATES
set index=16
call :UPDATES
set index=17
call :UPDATES
set index=18
call :UPDATES
set index=19
call :UPDATES
set index=20
call :UPDATES
rem Export all vanilla versions
rem title Exporting | %imagex% /compress maximum /export %~dp0w8MAIN.wim * %WimSource%
rem title Exporting | %imagex% /compress maximum /export %~dp0w7MAIN.wim * %WimSource%
rem Export %WimSource% to cleanup and compress better
title Exporting %WimSource% to minimize space | %imagex% /compress maximum /export %WimSource% * %~dp0install2.wim
IF EXIST %~dp0install2.wim echo del %WimSource%
echo aY | choice /n
goto :eof


:UPDATES
md %mount%
set details=%TEMP%\detail.log
set indexlog=%TEMP%\index.log
%Dism% /get-wiminfo /wimfile:%WimSource% > %indexlog%
%Dism% /get-wiminfo /wimfile:%WimSource% /index:%index% > %details%
if ERRORLEVEL 1 goto :eof
setlocal EnableDelayedExpansion
set "cmd=findstr /R /N "^^" %indexlog% | find /C "Index""
for /f %%a in ('!cmd!') do set indexs=%%a
if exist %details% (
  FOR /F "tokens=* skip=2 usebackq" %%a IN (`FIND "Architecture" %details%`) DO (
  set str=%%a
  for /f "tokens=2 delims=: " %%b in ('echo !str!') do (
  set arch=%%b
  )) 
)
if exist %details% (
  FOR /F "tokens=* skip=2 usebackq" %%a IN (`FIND "Edition" %details%`) DO (
  set str=%%a
  for /f "tokens=2 delims=: " %%c in ('echo !str!') do (
  set Edition=%%c
  )) 
)
if exist %details% (
  FOR /F "tokens=* skip=2 usebackq" %%a IN (`FIND "Version" %details%`) DO (
  set str=%%a
  for /f "tokens=2 delims=: " %%d in ('echo !str!') do (
  set Version=%%d
  )) 
)

echo %Edition% | find "Professional" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :PROnoWMC
:PROnoWMC
echo %Edition% | find "Core" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :CORE
:CORE
echo %Edition% | find "Enterprise" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :Enterprise
:Enterprise
echo %Edition% | find "ULTIMATE" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :ULTIMATE
:ULTIMATE
echo %Edition% | find "HomePremium" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :HomePremium
:HomePremium
echo %Edition% | find "HomeBasic" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :HomeBasic
:HomeBasic
echo %Edition% | find "Starter" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :Starter
:Starter
echo %Edition% | find "Server" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :Server
:Server
echo %Edition% | find "Business" > nul
if %ERRORLEVEL% == 1 goto :VERSION
if %ERRORLEVEL% == 0 goto :Business
:Business
goto :version

:VERSION
echo %VERSION% | find "6.2" > nul
if %ERRORLEVEL% == 0 goto :UpdateWIN8
echo %VERSION% | find "6.1" > nul
if %ERRORLEVEL% == 0 goto :UpdateWIN7
echo %Edition% | find "6.0*" > nul
if %ERRORLEVEL% == 0 goto :UpdateVista
echo %Edition% | find "SERVER*" > nul
if %ERRORLEVEL% == 0 goto :eof


:UpdateWIN8
set OS=8
set Description="Windows 8 %Edition% (%arch%) (%creationdate%)"
Echo Index is %index%  %Description%
title Mounting %index% %Description% | %Dism% /Mount-Wim /WimFile:%WimSource% /index:%index% /MountDir:%mount%
Echo.
Echo        Remove-DefaultAppAssociations
Echo.
IF EXIST %AppAssoc% echo title Remove-DefaultAppAssociations | %dism% /image:%mount% /Remove-DefaultAppAssociations
Echo.
Echo        Import-DefaultAppAssociations
IF EXIST %AppAssoc% echo title import-DefaultAppAssociations | %dism% /image:%mount% /import-DefaultAppAssociations:%AppAssoc%
Echo.

If "%ARCH%"=="x86" GOTO :x86
If "%ARCH%"=="x64" GOTO :x64
:x86
Echo       Adding Net3
Echo.
IF EXIST %Win8x86sxs% echo title Adding Net3 | %dism% /image:%mount% /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:%Win8x86sxs%
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update81%"
Echo.
IF EXIST %Win8x86sxs% echo title Adding %Update81% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update81%"
goto :MSU
:x64
Echo       Adding Net3
Echo.
IF EXIST %Win8x64sxs% echo title Adding Net3 | %dism% /image:%mount% /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:%Win8x64sxs%
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update81%"
Echo.
IF EXIST %Win8x64sxs% echo title Adding %Update81% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update81%"
goto :MSU

:MSU
rem Echo.
rem echo      "%update%\Windows %OS% %ARCH%\%Update81%"
rem Echo.
rem title Adding %Update81% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update81%"
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update82%"
Echo.
title Adding %Update82% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update82%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update83%"
Echo.
title Adding %Update83% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update83%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update84%"
Echo.
title Adding %Update84% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update84%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update85%"
Echo.
title Adding %Update85% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update85%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update86%"
Echo.
title Adding %Update86% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update86%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update87%"
Echo.
title Adding %Update87% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update87%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update88%"
Echo.
title Adding %Update88% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update88%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update89%"
Echo.
title Adding %Update89% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update89%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update810%"
Echo.
title Adding %Update810% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update810%"
goto :updates2

:UpdateWIN7
set OS=7
set Description="Windows %OS% %Edition% (%arch%) (%creationdate%)"
Echo Index is %index%  %Description%
title Mounting %index% %Description% | %Dism% /Mount-Wim /WimFile:%WimSource% /index:%index% /MountDir:%mount%
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update71%"
Echo.
title Adding %Update71% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update71%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update72%"
Echo.
title Adding %Update72% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update72%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update73%"
Echo.
title Adding %Update73% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update73%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update74%"
Echo.
title Adding %Update74% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update74%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update75%"
Echo.
title Adding %Update75% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update75%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update76%"
Echo.
title Adding %Update76% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update76%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update77%"
Echo.
title Adding %Update77% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update77%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update78%"
Echo.
title Adding %Update78% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update78%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update79%"
Echo.
title Adding %Update79% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update79%"
if ERRORLEVEL 1 goto :UPDATES2
Echo.
echo      "%update%\Windows %OS% %ARCH%\%Update710%"
Echo.
title Adding %Update710% | %Dism% /image:%mount% /Add-Package /PackagePath:"%update%\Windows %OS% %ARCH%\%Update710%"
goto :updates2

:UPDATES2
Echo.
cmd /c echo D | xcopy  %~dp0@OVERLAY\InstallWim\w%OS%%arch% %mount% /E /I /Y /h /d /r /c
title Unmounting %index% %Description% | %Dism% /Unmount-Wim /MountDir:%mount% /commit
rmdir /s /q %mount%
title %index% %Description% | %imagex% /info %WimSource% %Index% %Description% %Description%
goto :eof

:eof






Also tagged with one or more of these keywords: bcd, ntldr, boot.ini

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users