|
因为在VM下面试了N次不成功,所以想问一下大家是我的命令有问题还是其它的问题?
说明一下我的VM测试环境,C盘安装了XP,WIN7.VHD放在D盘子目录里面,用以下CMD去建立C盘的BCD文件,试了N次都失败,启动菜单是有的,可以看到,就是无法进VHD,不知道是什么原因。。。。。。。
@ECHO OFF
@CD /D "%~DP0"
@ATTRIB -R -A -S -H "%~DP0BOOTMGR"
IF NOT EXIST "C:\BOOTMGR" @COPY /Y /V "%~DP0BOOTMGR" "C:\" >NUL
@ATTRIB -R +A +S +H "C:\BOOTMGR"
IF NOT EXIST "C:\BOOT\" @MD "C:\BOOT\"
@ATTRIB -R +A +S +H "C:\BOOT"
IF EXIST "C:\BOOT\BCD" @COPY /Y /V "C:\BOOT\BCD" "C:\BOOT\BCD_BAK" >NUL
IF EXIST "C:\BOOT\BCD" @DEL /F /A /Q "\\?\C:\BOOT\BCD" >NUL
BOOTSECT.EXE /NT60 "C:" /FORCE /MBR >NUL
BCDEDIT.EXE /CREATESTORE "C:\BOOT\BCD" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /CREATE {BOOTMGR} /D "Windows Boot Manager" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {BOOTMGR} DEVICE PARTITION="C:" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {BOOTMGR} LOCALE "zh-CN" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /CREATE {NTLDR} /D "Microsoft Windows XP Professional" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {NTLDR} DEVICE PARTITION="C:" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {NTLDR} PATH "\NTLDR" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DISPLAYORDER {NTLDR} /ADDFIRST >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DEFAULT {NTLDR} >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "9" >NUL
@SET VID=
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /CREATE /D "%~DP0WIN7.VHD" /APPLICATION OSLOADER >"%TEMP%\VID.TXT"
FOR,/F,"TOKENS=2 DELIMS={",%%I,IN (%TEMP%\VID.TXT) DO (SET VIDA=%%I)
FOR,/F,"TOKENS=1 DELIMS=}",%%I,IN ("%VIDA%") DO (SET VID={%%I})
ECHO %VID%>"%TEMP%\VID.TXT"
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% DEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% PATH "\WINDOWS\SYSTEM32\WINLOAD.EXE" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% LOCALE "zh-CN" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% SYSTEMROOT "\WINDOWS" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% NX "OptIn" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% OSDEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% DETECTHAL ON >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DISPLAYORDER %VID% /ADDLAST >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /TIMEOUT 9 >NUL
@DEL /F /A /Q "%TEMP%\VID.TXT" >NUL
PAUSE
另外,如果用一个建立好的BCD是没问题的,下面这个是我拿别的BCD改好的“空的”的BCD,体积只有8K,如果用这个BCD,然后用以下命令行,可以正常进入VHD,经过多次的对比,发现自己创立出来的BCD与用这个现有BCD建立出来的BCD用BcdTool查看是一样的。。。但自己建立的就不无法进VHD,郁闷了。。。。。。。。。请大家帮忙看一下,多谢了。。。。。。。。。。
@ECHO OFF
@CD /D "%~DP0"
@ATTRIB -R -A -S -H "%~DP0BOOTMGR"
IF NOT EXIST "C:\BOOTMGR" @COPY /Y /V "%~DP0BOOTMGR" "C:\" >NUL
@ATTRIB -R +A +S +H "C:\BOOTMGR"
IF NOT EXIST "C:\BOOT\" @MD "C:\BOOT\"
@ATTRIB -R +A +S +H "C:\BOOT"
IF EXIST "C:\BOOT\BCD" @COPY /Y /V "C:\BOOT\BCD" "C:\BOOT\BCD_BAK" >NUL
@COPY /Y /V "%~DP0BCD_BAK" "C:\BOOT\BCD" >NUL
@ATTRIB -R -A -S -H "C:\BOOT\BCD"
BOOTSECT.EXE /NT60 "C:" /FORCE /MBR >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /CREATE {NTLDR} /D "Microsoft Windows XP Professional" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {NTLDR} DEVICE PARTITION="C:" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {NTLDR} PATH "\NTLDR" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DISPLAYORDER {NTLDR} /ADDFIRST >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DEFAULT {NTLDR} >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "9" >NUL
@SET VID=
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /CREATE /D "%~DP0WIN7.VHD" /APPLICATION OSLOADER >"%TEMP%\VID.TXT"
FOR,/F,"TOKENS=2 DELIMS={",%%I,IN (%TEMP%\VID.TXT) DO (SET VIDA=%%I)
FOR,/F,"TOKENS=1 DELIMS=}",%%I,IN ("%VIDA%") DO (SET VID={%%I})
ECHO %VID%>"%TEMP%\VID.TXT"
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% DEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% PATH "\WINDOWS\SYSTEM32\WINLOAD.EXE" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% LOCALE "zh-CN" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% SYSTEMROOT "\WINDOWS" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% NX "OptIn" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% OSDEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /SET %VID% DETECTHAL ON >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /DISPLAYORDER %VID% /ADDLAST >NUL
BCDEDIT.EXE /STORE "C:\BOOT\BCD" /TIMEOUT 9 >NUL
@DEL /F /A /Q "%TEMP%\VID.TXT" >NUL
[ 本帖最后由 0cat0 于 2010-5-7 12:10 编辑 ] |
|