无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 4524|回复: 29
打印 上一主题 下一主题

[分享] Wim镜像维护......

[复制链接]
跳转到指定楼层
1#
发表于 2023-12-4 17:38:11 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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




Screenshot 2023-12-06 200728.png (37.7 KB, 下载次数: 39)

直接拖放在...就行了

直接拖放在...就行了
2#
 楼主| 发表于 2023-12-4 19:24:20 | 显示全部楼层
本帖最后由 oym2016 于 2023-12-4 19:50 编辑
yyz2191958 发表于 2023-12-4 18:21
我不晓得怎么使用

晕 忘记修改Wim_Tools_reg.cmd中的路径了
修改后再贴

点评

辛苦了 谢谢  详情 回复 发表于 2023-12-4 19:25
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-5-11 16:59

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表