Dear friends,
i'd like to execute a reg file from the desktop. With this file, i write some informations to the registry. I know, i can write directly to the registry with:
key.SetValue("Example");
But afterwards, if i want to change some informations, i always need to change to whole program. So i tried:
Process regeditProcess = Process.Start("regedit.exe", @" /S /r C:\Users\example\Desktop\oeminfo.reg");
It starts correctly and asks for permission but when i accepted, nothing happens to the registry. I think there is some problem with the 64 bit Version, because there was the same issue with the RegistryKey method.
Sorry for potential mistakes.
lg Moritz
Moritz GutweinPosted Sep 8, 2014, 4:26 AM
Because when I write to the registry via key.SetValue, it looks like this:
using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
You see the ending? "Registry64"? Maybe its because of this...
I just dont know how to use it
Moritz GutweinPosted Sep 8, 2014, 4:04 AM
Guest UserPosted Sep 8, 2014, 3:44 AM
I assume you're logged in as Administrator, but you can try to restart machine. Maybe it helps, but I'm not confident enough.
Moritz GutweinPosted Sep 8, 2014, 3:28 AM
I tried your code snippet. But I get the same result as before. And I dont think it is because of the missing administrator permission. Because I already wrote:
to the app.manifest. And I am not sure if I missed something, but there is sadly no pop-up dialog. Could it be, that it only shows the change after a restart?
Guest UserPosted Sep 6, 2014, 5:08 AM
ProcessStartInfo info = new ProcessStartInfo("regedit.exe", @" /S /r C:\Users\example\Desktop\oeminfo.reg");
info.Verb = "runas";
Process.Start(info);
this might pop-up dialog box asking for username/pwd to run this. if you're admin over the machine then it should ideally work?
please try and let me know if this helped you or not.
Moritz GutweinPosted Sep 5, 2014, 5:46 AM
If there are any questions about it, just ask!
Btw. thanks for your help!
Guest UserPosted Sep 3, 2014, 10:26 AM
Sorry, one last question when you double click the application or you double click on .reg file above behavior happens?
Moritz GutweinPosted Sep 3, 2014, 5:35 AM
Yes it starts as when i double klick it on the desktop. In the next step i have to confirm to write right into the registry. The next window shows "Succesfully writen to registry". But when i refresh the registry, nothing has changed...
Guest UserPosted Sep 3, 2014, 4:35 AM
regedit.exe /S /r C:\Users\example\Desktop\oeminfo.reg
does it fire perfectly, I mean does it update registry file?