Board logo

标题: 能否从注册表中读出项目,并对其进行修改后再写入? [打印本页]

作者: cnds     时间: 2010-3-16 09:01    标题: 能否从注册表中读出项目,并对其进行修改后再写入?

批处理脚本能否从注册表中读出注册表项目,并对其进行修改后再写入?
以下注册表项是在程序安装过程中写入注册表的,由于涉及到用户选择安装路径的问题,因此必须等程序先生成,再利用批处理读出来,改成自己想要的,再写入注册表。
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{49D79F54-D485-4011-83FE-FFC938F3DB86}_is1]
"Inno Setup: Setup Version"="5.3.6.ee1 (a)"
"Inno Setup: App Path"="C:\\Program Files\\X2Online\\FortressForever"
"InstallLocation"="C:\\Program Files\\X2Online\\FortressForever\\"
"Inno Setup: Icon Group"="器飘府胶2 Forever"
"Inno Setup: User"="Administrator"
"DisplayName"="器飘府胶2 Forever"
"DisplayIcon"="C:\\Program Files\\X2Online\\FortressForever\\F2.ico"
"UninstallString"="\"C:\\Program Files\\X2Online\\FortressForever\\unins000.exe\""
"QuietUninstallString"="\"C:\\Program Files\\X2Online\\FortressForever\\unins000.exe\" /SILENT"
"DisplayVersion"="2.11.15.15"
"Publisher"="鼎盛中国(技术)"
"URLInfoAbout"="http://www.x2game.com"
"HelpLink"="http://www.x2game.com"
"URLUpdateInfo"="http://www.x2game.com"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001
"InstallDate"="20100316"
"MajorVersion"=dword:00000002
"MinorVersion"=dword:0000000b
然后修改成如下:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{49D79F54-D485-4011-83FE-FFC938F3DB86}_is1]
"App Path"="C:\\Program Files\\X2Online\\FortressForever"
"InstallLocation"="C:\\Program Files\\X2Online\\FortressForever\\"
"Icon Group"="器飘府胶2 Forever"
"User"="Administrator"
"DisplayName"="器飘府胶2 Forever"
"DisplayIcon"="C:\\Program Files\\X2Online\\FortressForever\\F2.ico"
"UninstallString"="\"C:\\Program Files\\X2Online\\FortressForever\\unins000.exe\""
"QuietUninstallString"="\"C:\\Program Files\\X2Online\\FortressForever\\unins000.exe\" /SILENT"
"DisplayVersion"="2.11.15.15"
"Publisher"="鼎盛中国(技术)"
"URLInfoAbout"="http://www.x2game.com"
"HelpLink"="http://www.x2game.com"
"URLUpdateInfo"="http://www.x2game.com"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001
"InstallDate"="20100316"
"MajorVersion"=dword:00000002
"MinorVersion"=dword:0000000b

作者: Hanyeguxing     时间: 2010-3-16 14:02
将新的子项或项添加到注册表中。

语法
reg add KeyName [/v EntryName|/ve] [/t DataType] [/s separator] [/d value] [/f]

返回注册表的子项下的项和下一层子项的列表。

语法
reg query KeyName [{/v EntryName|/ve}] [/s]

从注册表删除项或子项

语法
reg delete KeyName [{/v EntryName|/ve|/va}] [/f]

[ Last edited by Hanyeguxing on 2010-3-16 at 14:04 ]
作者: xqx     时间: 2010-8-15 05:56    标题: 我最服你了

楼上的,我最服你了!
你的帖子总是简单易行!
我要给你加分!