Replace a registry key with a batch file?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have the following registry key that I want to copy into the registry with
a batch file on shutdown [-HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\TypedURLs] named blankurls.reg. I have a batch file set up in the
WSH in the on Shutdown property as follows; Regedit.exe /s F:\Registry
Backup\blankurls.reg If I double click the registry entry it works fine,
but if I try to execute it with the batch file, it doesn't.

Can anyone tell me the proper syntax to use in a batch file so it works?
Thanks

Jim
 
Jim,

I'm not sure I completely follow the line: I have a batch file set up in the
WSH in the on Shutdown property as follows[...]

Where do you have the batch file set up to run this on shutdown?

Also, can you paste the contents of the batch file and the error and/or
errorlevel it returns with?

Best Regards,
G. Samuel Hays
 
I have the batch file in my system32 directory and I'm using the Windows
Scripting Host to run it at shutdown using the MMC gpedit.msc snap in under
startup and shutdown scripts. The batch file simply says:

Regedit.exe /s F:\Registry Backup\blankurls.reg

The batch file doesn't return any errors, it simply doesn't copy the
registry key into the registry like it's supposed too. Any ideas?

Jim

G. Samuel Hays said:
Jim,

I'm not sure I completely follow the line: I have a batch file set up in the
WSH in the on Shutdown property as follows[...]

Where do you have the batch file set up to run this on shutdown?

Also, can you paste the contents of the batch file and the error and/or
errorlevel it returns with?

Best Regards,
G. Samuel Hays





Jim said:
I have the following registry key that I want to copy into the registry
with
a batch file on shutdown [-HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\TypedURLs] named blankurls.reg. I have a batch file set up in
the
WSH in the on Shutdown property as follows; Regedit.exe /s F:\Registry
Backup\blankurls.reg If I double click the registry entry it works fine,
but if I try to execute it with the batch file, it doesn't.

Can anyone tell me the proper syntax to use in a batch file so it works?
Thanks

Jim
 
I guess the better question would have been:What are you trying to do? You
maybe able to enter the registry directly to change what you want. Please
post back. It's hard to tell you wether what you are doing is right or wrong
unless we can understand what your goal is. Post back.
 
I have a registry key that I exported called BlankUrls.reg with the
following entry:

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs]

I want to replace the existing key in the registry with the one above so
that the browser history will be cleared automatically when the computer
shuts down. If I double click on the registry key I backed up, it will put
it in the registry and everything is fine. But what I'm trying to do is
add/edit this key to the registry automatically with a batch file on shut
down.

My current batch file (that doesn't work) simply says: Regedit.exe /s
F:\Registry Backup\blankurls.reg

I'm trying to find the correct syntax to put in the batch file that will
make it enter the above registry key. Right now it acts like it works
because there are no errors or anything, but it simply doesn't copy the key.
I hope this helps clear things up.
Thanks for your help.

Jim
 
I figured it out. I was missing the quotes before and after the file path to
the exported registry key.

Jim said:
I have a registry key that I exported called BlankUrls.reg with the
following entry:

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs]

I want to replace the existing key in the registry with the one above so
that the browser history will be cleared automatically when the computer
shuts down. If I double click on the registry key I backed up, it will put
it in the registry and everything is fine. But what I'm trying to do is
add/edit this key to the registry automatically with a batch file on shut
down.

My current batch file (that doesn't work) simply says: Regedit.exe /s
F:\Registry Backup\blankurls.reg

I'm trying to find the correct syntax to put in the batch file that will
make it enter the above registry key. Right now it acts like it works
because there are no errors or anything, but it simply doesn't copy the key.
I hope this helps clear things up.
Thanks for your help.

Jim

The Unknown P said:
I guess the better question would have been:What are you trying to do? You
maybe able to enter the registry directly to change what you want. Please
post back. It's hard to tell you wether what you are doing is right or wrong
unless we can understand what your goal is. Post back.
 
Back
Top