|
发现WIM2VHD的问题后,自己弄了个在WIN7下只要有ImageX和install.wim就可以自动生成VHD的,方便自己方便别人,以下是CMD:
@ECHO OFF
@CD /D "%~DP0"
:MENU
ECHO.
ECHO.
ECHO.
ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
ECHO ┃ ┃
ECHO ┃ [1] 利用[INSTALL.WIM]生成[WIN7.VHD] ┃
ECHO ┃ ┃
ECHO ┃ [2] 将生成的[WIN7.VHD]加到[BCD]菜单 ┃
ECHO ┃ ┃
ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
ECHO.
:IMENU
SET CHOICE=
SET /P CHOICE=请输入数字或字母 [回车] 退出:
IF NOT "%CHOICE%"=="" SET CHOICE=%CHOICE%
IF /I "%CHOICE%"=="1" GOTO VHD
IF /I "%CHOICE%"=="2" GOTO BCD
IF /I "%CHOICE%"=="" @EXIT
CLS
GOTO MENU
:VHD
CLS
@ECHO CREATE VDISK FILE="%~DP0WIN7.VHD" MAXIMUM=65539 TYPE=EXPANDABLE>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO SELECT VDISK FILE="%~DP0WIN7.VHD">>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO ATTACH VDISK>>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO CREATE PARTITION PRIMARY>>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO ASSIGN LETTER=V>>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO FORMAT FS=NTFS QUICK LABEL=SYS-WIN7VHD>>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO EXIT>>"%TEMP%\DiskPart[ATTACH].TXT"
@ECHO SELECT VDISK FILE="%~DP0WIN7.VHD">"%TEMP%\DiskPart[DETACH].TXT"
@ECHO DETACH VDISK>>"%TEMP%\DiskPart[DETACH].TXT"
@ECHO EXIT>>"%TEMP%\DiskPart[DETACH].TXT"
ECHO.
ECHO.
ECHO.
ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
ECHO ┃ ┃
ECHO ┃ 请不要关闭窗口,后台正在处理中... ┃
ECHO ┃ ┃
ECHO ┃ 看进度请打开当前目录的 WIN7.VHD.TXT ┃
ECHO ┃ ┃
ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
ECHO.
DISKPART.EXE /S "%TEMP%\DiskPart[ATTACH].TXT">"%~DP0WIN7.VHD.TXT"
ImageX.EXE /APPLY "%~DP0INSTALL.WIM" 5 "V:">>"%~DP0WIN7.VHD.TXT"
DISKPART.EXE /S "%TEMP%\DiskPart[DETACH].TXT">>"%~DP0WIN7.VHD.TXT"
@START "" "%~DP0WIN7.VHD.TXT"
ECHO.
ECHO.
ECHO.
ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
ECHO ┃ ┃
ECHO ┃ 操作完成,按任意键返回菜单 ┃
ECHO ┃ ┃
ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
ECHO.
PAUSE>NUL
CLS
GOTO MENU
:BCD
CLS
SET VID=
BCDEDIT.EXE /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 /SET %VID% DEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /SET %VID% PATH "\WINDOWS\SYSTEM32\WINLOAD.EXE" >NUL
BCDEDIT.EXE /SET %VID% LOCALE "zh-CN" >NUL
BCDEDIT.EXE /SET %VID% INHERIT {BOOTLOADERSETTINGS} >NUL
BCDEDIT.EXE /SET %VID% SYSTEMROOT "\WINDOWS" >NUL
BCDEDIT.EXE /SET %VID% OSDEVICE VHD="[%~D0]%~P0WIN7.VHD" >NUL
BCDEDIT.EXE /SET %VID% DETECTHAL ON >NUL
BCDEDIT.EXE /DISPLAYORDER %VID% /ADDLAST >NUL
BCDEDIT.EXE /TIMEOUT 9 >NUL
@DEL /F /A /Q "%TEMP%\VID.TXT" >NUL
ECHO.
ECHO.
ECHO.
ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
ECHO ┃ ┃
ECHO ┃ 操作完成,按任意键返回菜单 ┃
ECHO ┃ ┃
ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
ECHO.
PAUSE>NUL
CLS
GOTO MENU |
|