无忧启动论坛

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

[原创] PE中增加对WIM\ESD\GHO\ISO关联CoolInstall操作

[复制链接]
1#
发表于 2021-8-31 20:25:47 | 显示全部楼层
  1. @echo off
  2. if not exist "%~dp0CoolInstall.exe" echo 请将此批处理文件放置在 CoolInstall 所在目录再执行! & pause>nul & goto end

  3. reg query "HKLM\SOFTWARE\Classes\.wim" /ve >nul 2>nul
  4. if %errorlevel% equ 0 goto assocwim
  5. reg add "HKLM\SOFTWARE\Classes\.wim" /ve /t REG_SZ /d cifile /f
  6. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  7. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  8. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f

  9. :Return2
  10. reg query "HKLM\SOFTWARE\Classes\.esd" /ve >nul 2>nul
  11. if %errorlevel% equ 0 goto AssocESD
  12. reg add "HKLM\SOFTWARE\Classes\.esd" /ve /t REG_SZ /d cifile /f
  13. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  14. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  15. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f

  16. :Return3
  17. reg query "HKLM\SOFTWARE\Classes\.gho" /ve >nul 2>nul
  18. if %errorlevel% equ 0 goto AssocGHO
  19. reg add "HKLM\SOFTWARE\Classes\.gho" /ve /t REG_SZ /d cifile /f
  20. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  21. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  22. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f

  23. :Return4
  24. reg query "HKLM\SOFTWARE\Classes\.iso" /ve >nul 2>nul
  25. if %errorlevel% equ 0 goto AssocISO
  26. reg add "HKLM\SOFTWARE\Classes\.iso" /ve /t REG_SZ /d cifile /f
  27. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  28. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  29. reg add "HKLM\SOFTWARE\Classes\cifile\shell\open\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f
  30. goto end

  31. :AssocWIM
  32. for /f "skip=2 tokens=2* delims= " %%i in ('reg query "HKLM\SOFTWARE\Classes\.wim" /ve') do call set WIMType=%%j
  33. reg add "HKLM\SOFTWARE\Classes\%WIMType%\shell\CIS" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  34. reg add "HKLM\SOFTWARE\Classes\%WIMType%\shell\CIS" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  35. reg add "HKLM\SOFTWARE\Classes\%WIMType%\shell\CIS\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f
  36. goto Return2

  37. :AssocESD
  38. for /f "skip=2 tokens=2* delims= " %%i in ('reg query "HKLM\SOFTWARE\Classes\.esd" /ve') do call set ESDType=%%j
  39. reg add "HKLM\SOFTWARE\Classes\%ESDType%\shell\CIS" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  40. reg add "HKLM\SOFTWARE\Classes\%ESDType%\shell\CIS" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  41. reg add "HKLM\SOFTWARE\Classes\%ESDType%\shell\CIS\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f
  42. goto Return3

  43. :AssocGHO
  44. for /f "skip=2 tokens=2* delims= " %%i in ('reg query "HKLM\SOFTWARE\Classes\.gho" /ve') do call set GHOType=%%j
  45. reg add "HKLM\SOFTWARE\Classes\%GHOType%\shell\CIS" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  46. reg add "HKLM\SOFTWARE\Classes\%GHOType%\shell\CIS" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  47. reg add "HKLM\SOFTWARE\Classes\%GHOType%\shell\CIS\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f
  48. goto Return4

  49. :AssocISO
  50. for /f "skip=2 tokens=2* delims= " %%i in ('reg query "HKLM\SOFTWARE\Classes\.iso" /ve') do call set ISOType=%%j
  51. reg add "HKLM\SOFTWARE\Classes\%ISOType%\shell\CIS" /ve /t REG_SZ /d "用 &CoolInstall 安装" /f
  52. reg add "HKLM\SOFTWARE\Classes\%ISOType%\shell\CIS" /v Icon /t REG_SZ /d "%~dp0CoolInstall.exe" /f
  53. reg add "HKLM\SOFTWARE\Classes\%ISOType%\shell\CIS\command" /ve /t REG_SZ /d "%~dp0CoolInstall.exe /Source:%%1" /f
  54. goto end

  55. :end
复制代码


点评

楼主我在PE试了下软件名字乱码是哪里的问题呢  详情 回复 发表于 2022-1-26 11:12
厉害了,大神!以上cmd命令,我测试了几个PE,都完美实现!Perfect !  详情 回复 发表于 2021-8-31 21:32

评分

参与人数 2无忧币 +10 收起 理由
444742627 + 5 厉害了
d9o + 5 很给力!

查看全部评分

回复

使用道具 举报

2#
发表于 2022-1-26 15:34:04 | 显示全部楼层
wuming520 发表于 2022-1-26 11:12
楼主我在PE试了下软件名字乱码是哪里的问题呢

楼主不是我,注意批处理文件的文本编码

点评

批处理文件的文本编码选择什么呢  详情 回复 发表于 2022-1-27 21:43
回复

使用道具 举报

3#
发表于 2022-1-27 21:48:58 | 显示全部楼层
wuming520 发表于 2022-1-27 21:43
批处理文件的文本编码选择什么呢

ANSI

点评

好的谢谢,是在PE下运行还是系统环境下运行呢  详情 回复 发表于 2022-1-27 22:01
回复

使用道具 举报

4#
发表于 2022-1-27 22:13:07 | 显示全部楼层
wuming520 发表于 2022-1-27 22:01
好的谢谢,是在PE下运行还是系统环境下运行呢

你在什么环境用就在什么环境运行

点评

好的谢谢  详情 回复 发表于 2022-1-27 23:29
回复

使用道具 举报

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

本版积分规则

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

闽公网安备 35020302032614号

GMT+8, 2024-5-21 17:01

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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