PDA

View Full Version : Create batch file to read and then write registry entry (WXP-Pro)



jimpy22
08-15-2004, 06:03 AM
Can any one tell me how to use a batch file to check a registry entry when it is run. If the registry entry is not what I want it to be then it will change it to the correct registry entry.

The exact example I need it for is checking in the HKCU part of the registry to check if the syncmode5 entry which controls whether internet explorer checks for a new page at every visit to a page is set not to automatic (value 4) but to always check (value 3).

Am I posting this in the correct forum and can anyone help. Thanks.

Agent_Faust
09-15-2004, 07:10 PM
Type Reg /? in the command prompt.
You could probably use the Reg \Query or \compare command to do a check or compare with another reg file on hard drive or registry. Then use the if then commands to set when Reg /Add command executes a .reg file on your hard drive.

lager
09-16-2004, 12:37 AM
Your best bet is vbscript.
Use
Set oShell = WScript.CreateObject("WScript.Shell")
to create a shell script object then the RegWrite and RegRead methods.
More details here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsMthRegRead.asp