[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[注册表类] [已解决]如何使用批处理根据注册表的某个值执行是否导入注册表的操作

注册表位置:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data]
先查询此项下是否有数据,若无则导入clock.reg

clock.reg内容如下:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data]
"Data1"=hex:01,00,00,e4,07,00,00,09,00,00,00,0a,00,00,00,0e,00,00,00,09,00,00,\
  00,04,00,00,00
"Text1"="test"
"Data2"=hex:01,00,00,e4,07,00,00,09,00,00,00,0a,00,00,00,0e,00,00,00,09,00,00,\
  00,04,00,00,00
"Text2"="test2"
"Data3"=hex:01,00,00,e4,07,00,00,09,00,00,00,0a,00,00,00,0e,00,00,00,09,00,00,\
  00,04,00,00,00
"Text3"="test3"

  1. reg query "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data"  /v Data1&&goto B||goto A
  2. :A
  3. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data1" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
  4. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text1" /t REG_SZ /d "test"
  5. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data2" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
  6. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text2" /t REG_SZ /d "test2"
  7. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data3" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
  8. reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text3" /t REG_SZ /d "test3"
  9. Exit
  10. :B
  11. echo 已有该值
  12. Exit
复制代码
1

评分人数

    • tmp05: 感谢分享!技术 + 1

TOP

返回列表