标题: [注册表类] [已解决]如何使用批处理根据注册表的某个值执行是否导入注册表的操作 [打印本页]
作者: tmp05 时间: 2020-9-10 14:16 标题: [已解决]如何使用批处理根据注册表的某个值执行是否导入注册表的操作
注册表位置:
[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"
作者: smss 时间: 2020-9-11 06:56
- reg query "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /v Data1&&goto B||goto A
- :A
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data1" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text1" /t REG_SZ /d "test"
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data2" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text2" /t REG_SZ /d "test2"
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Data3" /t REG_BINARY /d 010000e4070000090000000a0000000e0000000900000004000000
- reg add "HKLM\SOFTWARE\Wow6432Node\Lyb Software\Cartoon Clock\Alarm Data" /f /v "Text3" /t REG_SZ /d "test3"
- Exit
- :B
- echo 已有该值
- Exit
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |