How can I automate updates to the registry?
August 30, 1999
A. There are 2 main methods you can use to create scripts that can be run to automate the updates. The first is to create a .reg file which can then be run using
regedit /s
The format of the file is
REGEDIT4
[]
""="" a string value
""=hex: a binary value
""=dword: a dword value
for example
REGEDIT4
[HKEY_USERS.DEFAULTControl PanelDesktop]
"Wallpaper"="E:\WINNT\savtech.bmp"
"TileWallpaper"="0"
[HKEY_USERS.DEFAULTControl PanelColors]
"Background"="0 0 0"
Would set the default background and color before anyone logs on.
The second method is to user a Windows 95 style .inf file. These are run using the command
rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128
The format of the file is as follows
[Version]
Signature = "$Windows NT$"
Provider=%Provider%
[Strings]
Provider="SavillTech Ltd"
[DefaultInstall]
AddReg = AddReg
DelReg = DelReg
UpdateInis = UpdateInis
[AddReg]
[DelReg]
[UpdateInis]
Below are the keys to be used
HKCR | HKEY_CLASSES_ROOT |
HKCU | HKEY_CURRENT_USER |
HKLM | HKEY_LOCAL_MACHINE |
HKU | HKEY_USERS |
The file below is an .inf file which performs the same as the .reg file described earlier
[Version]
Signature = "$Windows NT$"
[DefaultInstall]
AddReg = AddReg
[AddReg]
HKU,".DEFAULTControl PanelColors","Background",0000000000,"0 0 0"
HKU,".DEFAULTControl PanelDesktop","Wallpaper",0000000000,"E:WINNTsavtech.bmp"
HKU,".DEFAULTControl PanelDesktop","TileWallpaper",0000000000,"1"
INF files can be generated automatically using the SYSDIFF utility if you have a difference file (sysdiff /inf )
A registry entry can also be deleted using .REG files. That is, if one has a.reg file with, e.g.,
[HKEY_CURRENT_USERTest]
to enter a key, then one can use
[-HKEY_CURRENT_USERTest]
to remove it.
About the Author
You May Also Like