无忧启动论坛

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

[原创] 查看修改打包WIM VHD 挂载分离的 小玩意儿

[复制链接]
跳转到指定楼层
1#
发表于 2015-6-1 16:26:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 x9tian 于 2015-6-23 06:51 编辑

系统要有DISM 组件  才能玩。
不进PE 时 想摆弄下PE 的 WIM文件。  还有就是当成 压缩软件用。

双击WIM 为挂载或卸载 (未挂载双击时为挂载,反之则反)。
挂载目录为    系统盘:\tool\
如果挂载了WIM  却一时候不起 WIM文件在哪个盘。可以直截进这个tool文件夹下的文件夹 右键卸载它。

基本把它当压缩软件在用。像寒冰王座 仙剑这些 单机游戏 压成WIM, 玩时挂载,不玩时卸载。  当然你也可以来装你的 爱情动作片

  1. @echo off& color 1f &title WIM挂卸载 BY x9tian from bbs.wuyou.com
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3. if /i not [%~dp0]==[%windir%\]  (
  4.         call :regs
  5. ) else (
  6. goto :%2
  7. )
  8. exit


  9. :unwim
  10. rem 卸载接口
  11. call :xz

  12. dism /unmount-wim /mountdir:%systemdrive%\tool\%~nx1.000 /!num%var%! && rd /s /q %systemdrive%\tool\%~nx1.000 && exit

  13. goto :eof

  14. :installwim
  15. rem 挂载接口
  16. md %systemdrive%\tool\%~nx1.000 2>nul
  17. cls&dism /mount-wim /wimfile:%1 /index:1 /mountdir:%systemdrive%\tool\%~nx1.000 && start /w %systemdrive%\tool\%~nx1.000 || call :unwim %1
  18. goto :eof

  19. :regs
  20. echo.reg注册
  21. assoc .wim=wimfile
  22. reg add HKEY_CLASSES_ROOT\wimfile /ve /d "wim磁盘映像"  /f
  23. reg add HKEY_CLASSES_ROOT\wimfile\defaulticon /ve /t reg_expand_sz /d "%%windir%%\system32\SHELL32.dll,199" /f
  24. reg add HKEY_CLASSES_ROOT\wimfile\shell /ve /d "load"  /f
  25. reg add HKEY_CLASSES_ROOT\wimfile\shell\load /ve /d "加/卸载[wim]配置(&L)" /f
  26. reg add HKEY_CLASSES_ROOT\wimfile\shell\load\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 installwim" /f
  27. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM] /ve /d "卸己挂载的WIM" /f
  28. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM]\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 folderwim" /f
  29. move /y "%~nx0" "%windir%\wiminstall.bat"
  30. goto :eof

  31. :folderwim
  32. call :xz
  33. cls&call dism /unmount-wim /mountdir:%1 /%%num%var%%%
  34. goto :eof

  35. :xz
  36. cls&color 2f
  37. echo. 1:保存修改卸载
  38. echo. 2:不保存卸载
  39. set /p var=请选择
  40. set num1=commit
  41. set num2=discard
  42. cls
  43. goto :eof
复制代码


下面的 增加了支持 VHD 格式的挂卸载(需要imagex 和 dism  )。((未挂载时双击为挂载,挂载后反之则反 ))

把代码保存运行一次就可以删除了:sleepy:
  1. @echo off& color 1f &title WIM挂卸载 BY x9tian from bbs.wuyou.com
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3. if /i not [%~dp0]==[%windir%\]  (
  4.         call :regs
  5. ) else (
  6. goto :%2
  7. )
  8. exit


  9. :unwim
  10. rem 卸载接口
  11. call :xz

  12. dism /unmount-wim /mountdir:%systemdrive%\tool\%~nx1.000 /!num%var%! && rd /s /q %systemdrive%\tool\%~nx1.000 && exit

  13. goto :eof

  14. :installwim
  15. rem 挂载接口
  16. md %systemdrive%\tool\%~nx1.000 2>nul
  17. cls&dism /mount-wim /wimfile:%1 /index:1 /mountdir:%systemdrive%\tool\%~nx1.000 && start /w %systemdrive%\tool\%~nx1.000 || call :unwim %1
  18. goto :eof

  19. :installvhd
  20. rem 挂载接口
  21. cls
  22. (
  23. echo.select vdisk file="%~1"
  24. echo.list vdisk
  25. echo.exit
  26. )>%temp%\vdisk_
  27. diskpart /s "%temp%\vdisk_"|find /i "%~1"|find /i "未打开已连接内容" >nul && set "vhd=detach" || set "vhd=attach"
  28. (
  29. echo.select vdisk file="%~1"
  30. echo.%vhd% vdisk
  31. echo.exit
  32. )>%temp%\vdisk_
  33. diskpart /s "%temp%\vdisk_" & del /a /q  "%temp%\vdisk_" 2>nul
  34. goto :eof

  35. :regs
  36. echo.reg注册
  37. assoc .wim=wimfile
  38. reg add HKEY_CLASSES_ROOT\wimfile /ve /d "wim磁盘映像"  /f
  39. reg add HKEY_CLASSES_ROOT\wimfile\defaulticon /ve /t reg_expand_sz /d "%%windir%%\system32\SHELL32.dll,199" /f
  40. reg add HKEY_CLASSES_ROOT\wimfile\shell /ve /d "load"  /f
  41. reg add HKEY_CLASSES_ROOT\wimfile\shell\load /ve /d "加/卸载[wim]配置(&L)" /f
  42. reg add HKEY_CLASSES_ROOT\wimfile\shell\load\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 installwim" /f
  43. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM] /ve /d "卸己挂载的WIM" /f
  44. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM]\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 folderwim" /f

  45. assoc .vhd=VHDFile
  46. reg add HKEY_CLASSES_ROOT\VHDFile /ve /d "VHD磁盘映像"  /f
  47. reg add HKEY_CLASSES_ROOT\VHDFile\defaulticon /ve /t reg_expand_sz /d "%%windir%%\system32\imageres.dll,39" /f
  48. reg add HKEY_CLASSES_ROOT\VHDFile\shell /ve /d "load"  /f
  49. reg add HKEY_CLASSES_ROOT\VHDFile\shell\load /ve /d "加/卸载[VHD]配置(&L)" /f
  50. reg add HKEY_CLASSES_ROOT\VHDFile\shell\load\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 installvhd" /f
  51. move /y "%~f0" "%windir%\wiminstall.bat"
  52. goto :eof

  53. :folderwim
  54. call :xz
  55. cls&call dism /unmount-wim /mountdir:%1 /%%num%var%%%
  56. goto :eof

  57. :foldervhd

  58. goto:eof
  59. :xz
  60. cls&color 2f
  61. echo. 1:保存修改卸载
  62. echo. 2:不保存卸载
  63. set /p var=请选择
  64. set num1=commit
  65. set num2=discard
  66. cls
  67. goto :eof
复制代码


第三段代码,挂载目录指定在 D:\TOOL文件夹,
适用于所有DISM组件的PE一般PE下系统盘空间都不够必须改下挂载目录
DISM方式的挂载不同于WIMNT.exe 它需要的是实体空间

  1. @echo off& color 1f &title WIM挂卸载 BY x9tian from bbs.wuyou.com
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3. if /i not [%~dp0]==[%windir%\]  (
  4.         call :regs
  5. ) else (
  6. goto :%2
  7. )
  8. exit


  9. :unwim
  10. rem 卸载接口
  11. call :xz

  12. dism /unmount-wim /mountdir:d:\tool\%~nx1.000 /!num%var%! && rd /s /q d:\tool\%~nx1.000 && exit

  13. goto :eof

  14. :installwim
  15. rem 挂载接口
  16. if exist d: md d:\tool\%~nx1.000 2>nul
  17. cls&dism /mount-wim /wimfile:%1 /index:1 /mountdir:d:\tool\%~nx1.000 && start /w d:\tool\%~nx1.000 || call :unwim %1
  18. goto :eof

  19. :installvhd
  20. rem 挂载接口
  21. cls
  22. (
  23. echo.select vdisk file="%~1"
  24. echo.list vdisk
  25. echo.exit
  26. )>%temp%\vdisk_
  27. diskpart /s "%temp%\vdisk_"|find /i "%~1"|find /i "未打开已连接内容" >nul && set "vhd=detach" || set "vhd=attach"
  28. (
  29. echo.select vdisk file="%~1"
  30. echo.%vhd% vdisk
  31. echo.exit
  32. )>%temp%\vdisk_
  33. diskpart /s "%temp%\vdisk_" & del /a /q  "%temp%\vdisk_" 2>nul
  34. goto :eof

  35. :regs
  36. echo.reg注册
  37. assoc .wim=wimfile
  38. reg add HKEY_CLASSES_ROOT\wimfile /ve /d "wim磁盘映像"  /f
  39. reg add HKEY_CLASSES_ROOT\wimfile\defaulticon /ve /t reg_expand_sz /d "%%windir%%\system32\SHELL32.dll,199" /f
  40. reg add HKEY_CLASSES_ROOT\wimfile\shell /ve /d "load"  /f
  41. reg add HKEY_CLASSES_ROOT\wimfile\shell\load /ve /d "加/卸载[wim]配置(&L)" /f
  42. reg add HKEY_CLASSES_ROOT\wimfile\shell\load\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 installwim" /f
  43. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM] /ve /d "卸己挂载的WIM" /f
  44. reg add HKEY_CLASSES_ROOT\Folder\shell\[WIM]\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 folderwim" /f

  45. assoc .vhd=VHDFile
  46. reg add HKEY_CLASSES_ROOT\VHDFile /ve /d "VHD磁盘映像"  /f
  47. reg add HKEY_CLASSES_ROOT\VHDFile\defaulticon /ve /t reg_expand_sz /d "%%windir%%\system32\imageres.dll,39" /f
  48. reg add HKEY_CLASSES_ROOT\VHDFile\shell /ve /d "load"  /f
  49. reg add HKEY_CLASSES_ROOT\VHDFile\shell\load /ve /d "加/卸载[VHD]配置(&L)" /f
  50. reg add HKEY_CLASSES_ROOT\VHDFile\shell\load\command /ve /t reg_expand_sz /d "%%windir%%\wiminstall.bat %%1 installvhd" /f
  51. move /y "%~f0" "%windir%\wiminstall.bat"
  52. goto :eof

  53. :folderwim
  54. call :xz
  55. cls&call dism /unmount-wim /mountdir:%1 /%%num%var%%%
  56. goto :eof

  57. :foldervhd

  58. goto:eof
  59. :xz
  60. cls&color 2f
  61. echo. 1:保存修改卸载
  62. echo. 2:不保存卸载
  63. set /p var=请选择
  64. set num1=commit
  65. set num2=discard
  66. cls
  67. goto :eof
复制代码
2#
发表于 2015-6-1 16:59:48 | 只看该作者
谢谢,学习下!
回复

使用道具 举报

3#
 楼主| 发表于 2015-6-23 06:53:48 | 只看该作者
修改WIM 时 修改完后再次双击WIM文件选择保存修改。 如果不记得WIM文件在哪 也可以 右键挂载目录卸载
回复

使用道具 举报

4#
发表于 2015-6-23 11:36:31 | 只看该作者
不错的说!顶一下
回复

使用道具 举报

5#
发表于 2015-6-23 13:49:21 | 只看该作者
好东西,认真学习一下。
谢LZ分享!
回复

使用道具 举报

6#
发表于 2015-7-4 10:25:07 | 只看该作者
看起来不错,学习一下
回复

使用道具 举报

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

本版积分规则

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

闽公网安备 35020302032614号

GMT+8, 2024-9-28 05:56

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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