You want to import changes to the Registry using a Registry (.reg) file.
Using a graphical user interface
Using a command-line interface
The following command imports a Registry key or subkey:
> regedit /s <FilePath>
> regedit /s c:\rallencorp.reg
' This code imports the contents of a Registry file. ' Since there are no scripting functions to do this, I simply ' shell out to the regedit tool to do it. ' strCommand = "regedit /s <FilePath>" strCommand = "regedit /s c:\rallencorp.reg" set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run(strCommand, 0, TRUE) if intRC <> 0 then WScript.Echo "Error returned from importing registry: " & intRC else WScript.Echo "No errors returned from importing the registry file" end if
Importing a Registry file is as easy as double-clicking it, but this is where the danger lies. Be careful anytime you import a Registry file; make sure it contains exactly what you want to import. If you accidentally import the wrong file, it can overwrite values you didn't intend to overwrite. Since Registry files are text-based, open a file in a text editor such as Notepad to see what it contains.