Sign in to follow this  
Followers 0
gazeranco

Installing a .reg file

18 posts in this topic

#1 ·  Posted (edited)

Hey all,

I am a noob...

That said, I am trying to create an installer for a little program I made, I tried using an actual installer creator type program but it was way too confusing, so far auto it works perfectly except for the registry part which I found on a post in the forums...

run("c:windowsregedit.exe /s c:myregfile.reg")

I thought that was install the file in silent mode?? but nothing happens, I dont mind if it pops up and asks the user to confirm changes to the registry if thats an easier option??

The files get copied using fileinstall but the registry does not get edited :(

Please help!! :)

Thanks,

Edited by gazeranco

Share this post


Link to post
Share on other sites



try c:windowsregedit c:myregfile.reg

Share this post


Link to post
Share on other sites

hmm that works, wonder why the /s option doesn't work.

Share this post


Link to post
Share on other sites

wait... no it doesn't, but it's ok... there appears to be an issue in the format of the command, it seems to be reading the directories as 2 different installs, it tries silently and reports no erros... cos its silent, when i take s away it asks me i say ok and then it asks me twice and there appears to be a problem with the directory structure... ill look at code again.

Share this post


Link to post
Share on other sites

Have you tried modifying the registry settings with AutoIt and not the .reg file?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I think there is a problem with this, it's typed out wrong?

run("c:windowsregedit.exe /s c:myregfile.reg")

Can anyone see the mistake?

Share this post


Link to post
Share on other sites

Brewman, no. I dont know how to do that? I thought if I can just run the .reg file then that does it all for me?

Share this post


Link to post
Share on other sites

You know what it is? I have a space, I think it doesn't like it??

"C:ProgramDataMy Program"

How do I make it like the space?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

See RegWrite in the Help much easier

run('c:windowsregedit.exe /s "c:folder with spacemyregfile.reg"')

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

RegWrite doesn't look easier?

I have what you put there, ("c:windowsregedit.exe /s c:folder spacemyregfile.reg')

If I run the example here, i will get this error...

regedit --> are you sure you want to run... "c:folder" --> ok, file does not exist!

then again

regedit --> are you sure you want to run... "spacemyregfile.reg" --> ok, file does not exist!

Share this post


Link to post
Share on other sites

You missed where Emiel used single quotes around the whole string, and double quotes around the path and filename of your .reg file.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

BTW, if you wrote the program, and I assume you also wrote the .reg file, then using RegWrite to recreate the keys/values on the machine you're installing on shouldn't be that difficult, after all, 90% of the work is already done inside the .reg file. It's mostly just cut and paste from there.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I would only add the caveat that it depends upon the number of registry entries. I worked on an install package that included several hundred entries, scattered among all the hives. In that case I opted for the one .reg file over a couple hundred RegWrites.

My preference, however, is to use shellexecute as it is a little easier to separate the program from the switches. I use this:

ShellExecute("regedit.exe", '/s "' & @DesktopDir & 'Mykey.reg"')
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Didn't you have to write the reg file initially, or at least the registry entries? I don't see how installing a reg file is any different than doing it programmatically. Also, if this is being done in any type of corporate environment, regedit is usually disable.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I did have to write the reg file initially, though for some of it I was able to do an export and merge, but you definitely have a point :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hey, I can see your point. But in this instance I just exported what I needed.

Thanks for the responses.

Share this post


Link to post
Share on other sites

I can only get it to work without the silent option, which is not an issue as the people using it know what it is and are all administrators on the network. Would be cool if it just did it though.

Thanks guys,

Share this post


Link to post
Share on other sites

Just a side note, as this might help another noob.

Windows does something called installer detection, so if you call your file setup.exe or installer.exe it will think it's an installer (which it kind of is!) and more than likely display a message at the end saying "this file failed to install properly" because your not doing things windows expects from an installer I guess...

So call it something more ambigious, like RunMe.exe. I am sure the detection process is more complex than this, but just renaming the output .exe worked for me.

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