|
本帖最后由 oym2016 于 2023-12-6 23:51 编辑
借用本论坛某大师PE镜像中的MountWim批处理学习 学习.....
在PC上用右键方式 处理PEWIM镜像比较方便 ...
MountWin.cmd
@echo off&PUSHD "%~dp0"
setlocal enabledelayedexpansion
set wim=%1
call :FindMountPoint 1%
if "!folder!"=="" (
if not exist %~dpn1 md %~dpn1 2>nul
call :ChoiseIndex %1
DISM.exe /Mount-Image /ImageFile:%1 /index:!index! /MountDir:%~dpn1\
) else (
call :ChoiseIndex %1
echo.&set/p user_select= Save image input: "y" ; discard changes: "Enter key"
if !user_select! equ y (set NL=Commit) else (set NL=discard)
DISM.exe /Unmount-Image /MountDir:%~dpn1\ /!NL!
rd /q "%~dpn1\" 1>nul 2>nul
if !user_select! equ y (%~dp0bin\wimlib-imagex.exe optimize %1 --check )
)
pause
exit
:ChoiseIndex
set maxIndex=1
for /f "tokens=2 eol=; delims=: " %%i in ('DISM /Get-ImageInfo /ImageFile:%1') do (
for %%a in (1 2) do (
if "%%i"=="%%a" set maxIndex=%%i
)
)
if not "!maxIndex!"=="1" (
@DISM /Get-WimInfo /WimFile:%1
@echo.
set /p index=ÇëÑ¡ÔñWimÓ³ÏñµÄË÷Òý:
) else (
set index=1
)
goto :eof
:FindMountPoint
for /f "tokens=2 eol=; delims= " %%i in ('DISM.exe /Get-MountedImageInfo') do (
if /i "%%i"=="%1" (
set folder=!value!
) else (
set value=%%i
)
)
goto :eof
WimBootCD.CMD
@echo off&PUSHD %~dp0
setlocal enabledelayedexpansion
set wim=%1
for /f %%i in ('date /t') do set datevar=%%i
call :ChoiseIndex %1
Dism.exe /Export-Image /SourceImageFile:%1 /SourceIndex:!index! /DestinationImageFile:".\iso\Sources\boot.wim" /Compress:maximum /CheckIntegrity /Bootable
"%~dp0bin\oscdimg.exe" -m -o -u2 -udfver102 -l%datevar% -bootdata:2#p0,e,b"%~dp0bin\etfsboot.com"#pEF,e,b"%~dp0bin\efisys.bin" ".\iso" %~dpn1.iso
pause
@echo clear Wim...
del /s /Q ".\iso\Sources\boot.wim" >nul
exit
:ChoiseIndex
set maxIndex=1
for /f "tokens=2 eol=; delims=: " %%i in ('DISM /Get-WimInfo /WimFile:%1') do (
for %%a in (1 2) do (
if "%%i"=="%%a" set maxIndex=%%i
)
)
if not "!maxIndex!"=="1" (
@DISM /Get-WimInfo /WimFile:%1
@echo.
set /p index=Please select the index number:
) else (
set index=1
)
goto :eof
|
-
直接拖放在...就行了
|