PDA

View Full Version : Cannot update registry from command line


Kevin Brault
January 31st 06, 07:27 PM
Hello everyone,

I have a batch file that executes a C++ executable. Before the executable it
deletes a key from the registry as follows:

echo.Windows Registry Editor Version 5.00>edraw.reg
echo.>>edraw.reg
echo.[-HKEY_CURRENT_USER\\Software\\eDrawings\\PROEOption s]>>edraw.reg
regedit edraw.reg


The C++ executable also deletes the same key by creating and calling a
similar batch file.


The problem I am having is that when the first batch file executes the
regedit command I get an error "Cannot import edraw.reg: Error accessing the
registry.". The C++ app does NOT have this same error. It works fine. I can
also manually merge edraw.reg by double clicking on it without any errors.


What is going on?

Thank you in advance for your help


Kevin J. Brault

Stan Brown
February 1st 06, 06:20 AM
Tue, 31 Jan 2006 12:27:53 -0700 from Kevin Brault
>:
> Hello everyone,
>
> I have a batch file that executes a C++ executable. Before the executable it
> deletes a key from the registry as follows:
>
> echo.Windows Registry Editor Version 5.00>edraw.reg
> echo.>>edraw.reg
> echo.[-HKEY_CURRENT_USER\\Software\\eDrawings\\PROEOption s]>>edraw.reg
> regedit edraw.reg

> The problem I am having is that when the first batch file executes the
> regedit command I get an error "Cannot import edraw.reg: Error accessing the
> registry.".

I don't know whether there are other problems, but at the least you
want "echo " and not "echo." on the third line.

Have you tried "type edraw.reg" and compared that to the result of a
registry export to make sure that the file looks right?

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/

Google