Sign in to follow this  
Followers 0
tachi

adding .reg file to script

12 posts in this topic

Simple question realy, i have a .reg file with data i want to import into the registry, i have tryed running regsvr32 like this

Run(@ComSpec & " /c " & "regsvr32 /s "&@ScriptDir&"\register.reg", "", @SW_HIDE)

but it fails because the path is

C:\WINDOWS\system32\cmd.exe /c regsvr32 /s C:\autoit work\register.reg

and it needs to have ""'s around the C:\autoit work\register.reg because of the namespaces, how can i escape the ""''s in the run line so they are given to regsvr32 so it should look like this

C:\WINDOWS\system32\cmd.exe /c regsvr32 /s "C:\autoit work\register.reg"

thanks

Share this post


Link to post
Share on other sites



"" = one escaped " when within quotes

Share this post


Link to post
Share on other sites

"" = one escaped " when within quotes

thanks, i am now running

C:\WINDOWS\system32\cmd.exe /c regsvr32 "C:\Autoit work\regkeyinfo.reg"

and RegSvr32 thows

"C:\Autoit work\regkeyinfo.reg" is not an executable file and no registration helper is registered for this file type.

what am i doing wrong?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

regsrv32 does not run in a cmd box (at least not on my system) so drop the comspec.

Try:

run('regsrv32 /s "' & $pathnameRegFile & '"')
Edited by Uten

Share this post


Link to post
Share on other sites

regsrv32 does not run in a cmd box (at least not on my system) so drop the comspec.

Try:

run('regsrv32 /s "' & $pathnameRegFile & '"')

eargh, still dosent work even without using a cmd box, ive spent hours on this small little problem and grrrrrrr

Share this post


Link to post
Share on other sites

A couple of examples

RunWait('regsvr32 /s "C:\Autoit work\regkeyinfo.reg"')

RunWait('regsvr32 /s "' & @ScriptDir & '\register.reg"') ; using a macro also can have spaces in path

:P

Share this post


Link to post
Share on other sites

A couple of examples

RunWait('regsvr32 /s "C:\Autoit work\regkeyinfo.reg"')

RunWait('regsvr32 /s "' & @ScriptDir & '\register.reg"') ; using a macro also can have spaces in path

:P

i tryed the second with the macro in, but its still saying

"C:\Autoit work\regkeyinfo.reg" is not an executable file and no registration helper is registered for this file type.

copyed and pasted from your reply,?

Share this post


Link to post
Share on other sites

I wonder if you have an issue with your PATH variable.

Try this

RunWait(@SystemDir & '\regsvr32 /s "' & @ScriptDir & '\register.reg"')

still the same, ime takeing out the /s so i can see the error, else it just runs and i have to check the registry

FYI, the key is an exported key from the same machine which i then delete to test if the script it working

Share this post


Link to post
Share on other sites

I have a giant question here. Isn't regsvr32 meant for registering COM components? If you want to merge a reg file with the Windows Registry, shouldn't you send the file to regedit then hit OK?

I'm wondering also though, if AutoIt has registry editing capabilities, why not use them?

Share this post


Link to post
Share on other sites

That makes perfect sense, Icekirby1. Caught up in copying code.

RunWait('regedit /s "' & @ScriptDir & '\register.reg"')

Now that should work.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

That makes perfect sense, Icekirby1. Caught up in copying code.

RunWait('regedit /s "' & @ScriptDir & '\register.reg"')

Now that should work.

heh yeah he is totaly right

http://support.microsoft.com/kb/310516/

er, a big whoops on my part, was writeing batch files last week for DLL files and got mixed up

thanks for your help guys, and er, sorry

Edited by tachi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0