swcnchen˽ԭͿ룬ǲĺãͷ

+------------------------------------------------------------------------------------+
|  Ϊģʽ1ԭҲgrub4dosװvista,2008,win7,2008r2Ľ̳   |
+------------------------------------------------------------------------------------+

GRUB4DOSϵͳһƼڴGRUB4DOSǸ⣬ҲΪGRUB4DOSǿܣ

ע2000/XP/2003ȫXPû32λ/64λ֣֮vista/2008/win7ȫvistaҲû32λ/64λ֣֮ἰCϸ˵ΪӲ̵ĻΪȫC̣̷ԼԺ

û¼ѣӲ̰װϵͳһ̸⣬һЩ򵥵İװͲ̸ˣԭ32λXP/VISTAװ32λVISTA64λXP/VISTAװ64λVISTAӦPEϵͳֱӰװͬλVISTAϵͳЩֱӰװ

ԵĶ32λXP/VISTAװ64λVISTA64λXP/VISTAװ32λVISTAп¼ҲʡһẒ́VISTAװWINDOWSSETUPװ̷ͬҪʵֹ̰װ̷ṹҲԲʹ

ŵ㣺
һȫʹõǾɷ޸ķԾĻgrub4dos޷밲װ棬ҲӰԭϵͳ
ͨãԭϵͳXPVISTAԣԭϵͳҪװϵͳû32λ64λơ
㣺ȡISOеİװļֻһȡͬһλãλȡ

WIN7װرʾ
WIN7ڰװ̺ͰװVISTAWIN2008вٸĽñװWIN7һڶϵͳVista Hard Disk Installer޸͡ʾֱӿʼװȫ̺͹һֱӰװȻͬƼװڰװڷ
עĲõMSDNVISTAװISOOEMԭ棨޸ѡҲԣ޸İ棨̫̫ңڱ֮ڡ
עMSDNС/ȫ/OEMϰװ֤͸ܳףװ룩ļӦOEMһֻMSDN

*************************************
ϻ˵˲٣Ŀʼ
*************************************

ǰ׼MSDNVISTAӳISOغƻUltraISOѹӲһϵͳƼҪװVISTAķУעǸƻѹ÷Ŀ¼£ĳһļ¡ѹ/ƺļbootmgrsetup.exeautorun.infļУbootefisourcessupportupgradeԷɰװҪɾЩװļ

ظ棬winrarѹǰļкvista hdd installerļļzchzr.mbrzchzr޸ĵĻGRUB4DOSĺļboot.iniʹã
עֻԭϵͳǵϵͳϵͳ̫࣬һһѿԸӦİװ

һǰϵͳXP
һѸеzchzr.mbrzchzrC̸ļ¡١ҵĵԡҼԡ߼á༭һC:\zchzr.mbr="Vista Hard Disk Installer"
PSһַԴ򿪸еboot.ini/ճ

ϵͳһVista Hard Disk Installerѡ˵ѡ룬ѡʼװѡ½ǵġ޸ѡʾǰ׼аװẸԣ
e:
cd \sources
setup

ʣµĲͺ͹̰װȫһҪʽװڷװڴŰװļEϣװϳ˫ϵͳʽC̽ΪVISTAϵͳȫԼˡװɺװɶϵͳĻ޸Ӧboot.iniһԭɾzchzrzchzr.mbr

ǰϵͳVISTA vistaϵͳĬC̲boot.iniļ
һѸеzchzr.mbrzchzrboot.iniC̸ļ
עһҪעϵͳи߼õбȴʱ䣬Ͳˡ

ϵͳһVista Hard Disk Installerѡ˵ѡ룬ѡʼװѡ½ǵġ޸ʾ޸ѡ񡰷񡱣ӲϵͳѰװVISTAĻҲмհ״ʹֵľϵͳҪɫһѡʾǰ׼аװẸ:
e:
cd \sources
setup

ʣµĲͺ͹̰װȫһҪʽװڷװڴŰװļEϣװϳ˫ϵͳʽC̽ΪVISTAϵͳȫԼˡװɺװɶϵͳĻɾC̵zchzrzchzr.mbrboot.ini


+--------------------+
|  Ϊģʽ2ԭ   |
+--------------------+


ģʽ1ԭѾܹ(http://bbs.pcbeta.com/thread-372121-1-1.html¥),ڽһģʽ2Ļ.
ǰϵͳΪVISTA/2008/WIN7/2008R2ʱ,װE̸Ŀ¼Ϊ
BCDEDITΪE̵İװһ˵Ϳ.ʵ
set vhiuid1={66666666-fa0f-11da-8ddf-001320035401}
set vhiuid2={77777777-fa0f-11da-8ddf-001320035401}
bcdedit /create %vhiuid1% /d "nt6 hdd Installer mode 2" /device >nul
bcdedit /set %vhiuid1% ramdisksdidevice partition=e: >nul
bcdedit /set %vhiuid1% ramdisksdipath \boot\boot.sdi >nul
bcdedit /create %vhiuid2% /d "nt6 hdd Installer mode 2 [EMS Enable]" /application osloader >nul
bcdedit /set %vhiuid2% device ramdisk=[e:]\sources\boot.wim,%vhiuid1% >nul
bcdedit /set %vhiuid2% path  \windows\system32\boot\winload.exe >nul
bcdedit /set %vhiuid2% locale  en-US >nul
bcdedit /set %vhiuid2% osdevice ramdisk=[e:]\sources\boot.wim,%vhiuid1% >nul
bcdedit /set %vhiuid2% systemroot \windows >nul
bcdedit /set %vhiuid2% detecthal Yes >nul
bcdedit /set %vhiuid2% winpe Yes >nul
bcdedit /set %vhiuid2% ems Yes >nul
bcdedit /displayorder %vhiuid2% /addlast >nul
pause
һִкͿmode2˵,eϵϵͳװ򲢽밲װ,ҲӶε֤Ͱ汾bootmgrļԵø߰汾ϵͳװ.滻bootmgrȲ.ʵԭǳ,ֻ֮ǰû뵽,뵽˲˵˾ûʲôر֮.
ǰϵͳ2000/xp/2003,mode2ֹԷһЩ,Ͳ,ϵͳӦһ.
Ϊһ߷,ֻΪͬѲͬϵͳͬĲ


+---------------------------+
|  Ϊv2.6Դ   |
+---------------------------+


ҪԴ,һ,v2.6Դ,дò,Ц.
  rem >nul
cls
@echo off
mode con cols=80 lines=25
setlocal enabledelayedexpansion
color 1f
chcp 936>nul
if !errorlevel! equ 0 goto start
chcp 950>nul
if !errorlevel! equ 0 goto start
if %windir:~0,2% equ X: goto start
cls
echo.
echo      Please Change your System Non-Unicode to [Simplified  Chinese]
echo.
echo      or [Traditional Chinese]
echo.
echo  Press any key to Continue ......
pause >nul
:start
chcp 950 >nul
if !errorlevel! gtr 0 (
chcp 936
   set line1=qr
   set line2=                                                                          
   set line3=ts
    set msg1=װ/жس
    set msg2=ǰϵͳVista/2008/Win7Ƽʹģʽ 2
    set msg3=󣡣رUACһԹԱУ˳......
    set msg4=......
    set msg5=[1] װ nt6 hdd Installer ģʽ 1 : ǰϵͳΪ2000/xp/2003ʱƼʹ      
  set msg5_1=[2] װ nt6 hdd Installer ģʽ 2 : ǰϵͳΪvista/2008/7/PEʱƼʹ   
    set msg6=[3] ж nt6 hdd Installer ģʽ 1 ģʽ 2                                
  set msg6_a=[4] ˳                                                                  
  set msg6_0= װǰȷѾvista/2008/win7װȡ/ѹӲĳĿ¼ 
  set msg6_1= ģʽ˵:ѡװһֻģʽͬʱװ
    set msg7=ѡҪеĲ [1/2/3/4] Ȼ󰴻س
   set msg10=ǰϵͳ2000/XP/2003Ƽʹģʽ 1
   set msg11=ǰϵͳWinPEֻʹģʽ 2
   set msg12=δ֪ԭҲ˵ļboot.ini˵δ
   set msg13=ģʽ 1 װ
set msg13_1=ģʽ 2 װ
   set msg14=ѡ nt6 hdd Installer mode 1 ϵͳװ
set msg14_1=ѡ nt6 hdd Installer mode 2 [EMS Enable] ϵͳװ
   set msg16=ͬʱж nt6 hdd Installer ģʽ 1 ģʽ 2
   set msg18=жɣ
   set msg19=ϵͳBCDڴ޷˵ʹBCDautofix^(v1.0.3߰汾^)޸
   set msg20=BCDٴγ԰װ  ʹԭʼ^(Vista HDD Installer^)˳...
   set msg24=PEϵͳݲְ֧װģʽ 1رҪ밲װģʽ 2
   set msg25=Ч̷ûVista/2008/Win7װ뽫Vista/2008/Win7
   set msg26=װȡӲĳĿ¼ٴΰװģʽ 2
   set msg27=ϷVista/2008/Win7װ
   set msg28=ģʽ 2 δ֪ԭװʧܣ
) else (
chcp 950
   set line1=~wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
   set line2=x                                                                          x
   set line3=wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
set msg1=w/{
set msg2=etΡGVista/2008/Win7AϥμҦ 2
set msg3=~IIIUACΥk{ǦZHtκ޲zBAhX......
set msg4=^Dɭ......
set msg5=x[1] w nt6 hdd Installer Ҧ 1 : etά2000/xp/2003ɱϥ      x
set msg5_1=x[2] w nt6 hdd Installer Ҧ 2 : etάvista/2008/7/PEɱϥ   x
set msg6=x[3]  nt6 hdd Installer Ҧ 1 MҦ 2                                x
set msg6_a=x[4] hX                                                                  x
  set msg6_0=x w˫eнT{wgvista/2008/win7w˵{/ܥawLYϮڥؿ x
set msg6_1= Ҧ:iHܦw˨䤤@ةΨؼҦPɦw
set msg7=пܭni檺ާ@ [1/2/3/4] AMZ^G
set msg10=etΡG2000/XP/2003AϥμҦ 1
set msg11=etΡGWinPEAȥuϥμҦ 2
set msg12=~:]䤣}tmboot.iniA}楼K[
set msg13=Ҧ 1 w˧
set msg13_1=Ҧ 2 w˧
set msg14=ҿ nt6 hdd Installer mode 1 itΦw
set msg14_1=ҿ nt6 hdd Installer mode 2 [EMS Enable] itΦw
set msg16=ާ@NPɨ nt6 hdd Installer Ҧ 1 MҦ 2
set msg18=A
set msg19=tBCDsb~ALkK[}AϥBCDautofix^(v1.0.3Χ󰪪^)i`
set msg20=BCDZAզw  ϥέlk^(Vista HDD Installer^)AhX...
set msg24=PEtΤȤw˼Ҧ 1ApSOݭnAЦw˼Ҧ 2A
set msg25=~GbҦĽLŤSo{Vista/2008/Win7w˵{ǡAбNVista/2008/Win7w
set msg26=˵{ǴܥawLYϮڥؿZAw˼Ҧ 2
set msg27=Wo{Vista/2008/Win7w˵{
set msg28=Ҧ 2 ]w˥ѡIII
)
cls
title nt6 hdd Installer v2.6 !msg1! by chzhlh
echo.
if %windir:~0,2% equ X: (
if exist c:\boot\bcd (
  be >nul
  if !errorlevel! gtr 0 echo  !msg19! &echo. &echo  !msg20! &echo. &pause>nul &exit)
set /a wver=0
set driverall=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: Y: Z:
set msg100=!msg11!
) else (
if exist %windir%\system32\slmgr.vbs  (
  if exist nt6hdd.temp.* attrib -r -h -s nt6hdd.temp.* >nul & del nt6hdd.temp.* >nul
  be /createstore nt6hdd.temp >nul
  if !errorlevel! gtr 0 echo  !msg2! &echo. &echo  !msg3! & pause>nul &exit
  set /a wver=6
  set driverall=A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:
  set msg100=!msg2!
  be >nul
  if !errorlevel! gtr 0 echo  !msg19! &echo. &echo  !msg20! &echo. &pause>nul &exit
  ) else (
  if exist c:\boot\bcd (
   be >nul
   if !errorlevel! gtr 0 echo  !msg19! &echo. &echo  !msg20! &echo. &pause>nul &exit)
  set /a wver=5
  set driverall=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:
  set msg100=!msg10!)
)
set vhiuid={66666666-fa0f-11da-8ddf-001320035401}
set vhiuid1={77777777-fa0f-11da-8ddf-001320035401}
set vhiuid2={88888888-fa0f-11da-8ddf-001320035401}
:begin
cls
echo  !line1!
echo  !msg6_0!
echo  !line3!
echo.
echo !msg6_1!
echo.
echo  !line1!
echo  !msg5!
echo  !line2!
echo  !msg5_1!
echo  !line2!
echo  !msg6!
echo  !line2!
echo  !msg6_a!
echo  !line3!
echo.
set coi=
set coi1=
echo  !msg100!
echo.
Set /P coi= !msg7!
set coi1=%Coi:~0,1%
if /i "!coi1!"=="1" goto install
if /i "!coi1!"=="2" goto install2
if /i "!coi1!"=="3" goto uninstall
if /i "!coi1!"=="4" goto quitt
goto begin

:install
echo.
if !wver! equ 0 (
echo  !msg24!!msg4!
pause >nul
goto begin
)
if !wver! equ 6 (
if not exist c:\zchzr xcopy /y zchzr c:\ >nul
if not exist c:\zchzr.mbr xcopy /y zchzr.mbr c:\ >nul
be /create %vhiuid% /d "nt6 hdd Installer mode 1" /application bootsector >nul
be /set %vhiuid% device partition=c: >nul
be /set %vhiuid% path \zchzr.mbr >nul
be /displayorder %vhiuid% /addlast >nul
be /timeout 8 >nul
) 
if !wver! equ 5 (
if not exist c:\boot.ini echo  !msg12! &echo. &echo  !msg4! &pause>nul &goto begin
if not exist c:\zchzr xcopy /y zchzr c:\ >nul
if not exist c:\zchzr.mbr xcopy /y zchzr.mbr c:\ >nul
type c:\boot.ini|find "zchzr.mbr" /i >nul
if !errorlevel! gtr 0 (
  attrib -h -r -s c:\boot.ini >nul
  copy /y c:\boot.ini %temp%\boot.ini.vhi >nul
  echo [boot loader] >c:\boot.ini
  echo timeout=8 >>c:\boot.ini
  type %temp%\boot.ini.vhi|find "loader]" /i /v|find "timeout" /i /v|find ";" /i /v >>c:\boot.ini
  echo c:\zchzr.mbr="nt6 hdd Installer mode 1">>c:\boot.ini
  attrib +s +h c:\boot.ini >nul
  )
)
attrib +r +h +s c:\zchzr.*
echo ======================================================================
echo.
echo  nt6 hdd Installer !msg13!
echo.
echo  !msg14!
echo.
echo  !msg4! & pause>nul & goto begin
:install2
echo.
set /a foundsources=0
for %%A in (!driverall!) do (
  if !foundsources! equ 0 (
   if exist %%A\boot\boot.sdi (
    if exist %%A\sources\setup.exe (
     if exist %%A\bootmgr (
      if exist nt6hdd.temp.* attrib -r -h -s nt6hdd.temp.* >nul & del nt6hdd.temp.*
      be /createstore nt6hdd.temp >nul
      be /store nt6hdd.temp /create {bootmgr} /d "Drivetest" >nul
      be /store nt6hdd.temp /set  {bootmgr} device partition=%%A >nul
      if !errorlevel! equ 0 (
       set sourcesdrive=%%A
       set /a foundsources=1
  ))))))
if !foundsources! equ 0 echo  !msg25! &echo        !msg26! &echo. &echo  !msg4! &pause>nul &goto begin
echo   !sourcesdrive!!msg27!
echo.
echo ======================================================================
if !wver! neq 6 (
if not exist c:\boot\bcd (
  if exist nt6hdd.temp.* attrib -r -h -s nt6hdd.temp.* >nul & del nt6hdd.temp.*
  be /createstore nt6hdd.temp >nul
  be /import nt6hdd.temp >nul
  be /create {bootmgr} /d "Windows Boot Manager" >nul
  be /set {bootmgr} device boot >nul
  )
if not exist c:\bootmgr (attrib -h -s !sourcesdrive!\bootmgr >nul &copy; !sourcesdrive!\bootmgr c:\ >nul)
) 
   
echo.
   
be /create %vhiuid1% /d "nt6 hdd Installer mode 2" /device >nul
be /set %vhiuid1% ramdisksdidevice partition=!sourcesdrive! >nul
be /set %vhiuid1% ramdisksdipath \boot\boot.sdi >nul
be /create %vhiuid2% /d "nt6 hdd Installer mode 2 [EMS Enable]" /application osloader >nul
be /set %vhiuid2% device ramdisk=[!sourcesdrive!]\sources\boot.wim,%vhiuid1% >nul
be /set %vhiuid2% path  \windows\system32\boot\winload.exe >nul
be /set %vhiuid2% locale  en-US >nul
be /set %vhiuid2% osdevice ramdisk=[!sourcesdrive!]\sources\boot.wim,%vhiuid1% >nul
be /set %vhiuid2% systemroot \windows >nul
be /set %vhiuid2% detecthal Yes >nul
be /set %vhiuid2% winpe Yes >nul
be /set %vhiuid2% ems Yes >nul
be /displayorder %vhiuid2% /addlast >nul
be | find "!vhiuid2!" >nul
if !errorlevel! gtr 0 (
echo  nt6 hdd installer !msg28!
echo.
echo  !msg4! & pause>nul & goto begin
)
be /timeout 8 >nul
if !wver! equ 5 (
be /create {ntldr} /d "Earlier Version of Windows" >nul
be /set {ntldr} device boot >nul
be /set {ntldr} path \ntldr >nul
be /displayorder {ntldr} /addfirst >nul
be /default {ntldr} >nul
)
if !wver! equ 0 (
if exist c:\ntldr (
  be /create {ntldr} /d "Earlier Version of Windows" >nul
  be /set {ntldr} device boot >nul
  be /set {ntldr} path \ntldr >nul
  be /displayorder {ntldr} /addfirst >nul
  be /default {ntldr} >nul
))
if exist c:\bootmgr (
if !wver! equ 5 (bs /nt60 c: >nul)
if !wver! equ 0 (bs /nt60 c: /mbr >nul)
)
echo  nt6 hdd Installer !msg13_1!
echo.
echo  !msg14_1!
echo.
echo  !msg4! & pause>nul & goto begin

:uninstall
echo.
echo  !msg16!
echo.
be /delete %vhiuid% /f >nul
for %%A in (!driverall!) do (
if exist %%A\zchzr attrib -r -h -s %%A\zchzr &del %%A\zchzr >nul
if exist %%A\zchzr.mbr attrib -r -h -s %%A\zchzr.mbr &del %%A\zchzr.mbr >nul 
  if exist %%A\boot.ini (
   type %%A\boot.ini|find "zchzr.mbr" /i >nul
   if !errorlevel! equ 0 (
    attrib -r -h -s %%A\boot.ini >nul
    copy /y %%A\boot.ini %temp%\boot.ini.unc >nul
    type %temp%\boot.ini.unc|find "zchzr.mbr" /i /v >%%A\boot.ini
    attrib +h +s %%A\boot.ini >nul
      )
     )
         )
echo ======================================================================
echo.
be /delete !vhiuid1! /f >nul
be /delete !vhiuid2! /f >nul
if !wver! neq 6 (
  be /enum bootmgr | find /n /i "displayorder" >nt6hdd.temp
  be /enum bootmgr | find /n /i "timeout" >>nt6hdd.temp
  find /i "[8]displayorder" nt6hdd.temp >nul && set /a aa=1 || set /a aa=0
  find /i "[9]timeout" nt6hdd.temp >nul && set /a bb=1 || set /a bb=0
  set /a aa=!aa!+!bb!
  if !aa! equ 2 (
   find /i "[8]displayorder" nt6hdd.temp | find /i "ntldr" >nul
   if !errorlevel! equ 0 (
    if exist c:\ntldr (
     bs /nt52 c:>nul
     ))))

echo  !msg18!!msg4! &pause>nul &goto begin
:quitt
set coi=%Coi:~0,5%
if /i "!coi!"=="4NT52" goto i1
if /i "!coi!"=="4NT60" goto i2
exit
:i1
if !wver! equ 6 goto begin
if not exist c:\ntldr goto begin
cls
echo.
bs /nt52 c: >nul
if !errorlevel! equ 0 (echo. &echo  Change Boot Record to NT52...OK) else (echo   Change Boot Record to NT52...Error)
echo.
echo  Press any key to Exit......
pause >nul
exit
:i2
if !wver! neq 6 (
if not exist c:\bootmgr exit
if not exist c:\boot\bcd exit
)
cls
echo.
if !wver! neq 6 (bs /nt60 c: >nul) else (bs /nt60 sys >nul)
if !errorlevel! equ 0 (echo. &echo  Change Boot Record to NT60...OK) else (echo   Change Boot Record to NT60...Error)
echo.
echo  Press any key to Exit......
pause >nul
exit
