Reputation: 5248
I have a problem. I execute the code like below. after that I looked at the regedit file, the "test.reg" file didnt add. what do you think about the problem
content of the regedit file is :
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Wow6432Node\efe]
"key1"="value"
"key2"="value2"
the code is :
static void Main()
{
Process regeditProcess = Process.Start("regedit.exe", "/s " + @"D:\Projects\efe\efe\bin\Debug\test.reg");
regeditProcess.WaitForExit();
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}
thanks for your advice...
Upvotes: 2
Views: 4285
Reputation: 1408
If you have administrative rights this should work if not you could try to create registry keys from c# directly :
Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"Software\Wow6432Node\efe");
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Wow6432Node\efe",true).SetValue("key1", "value", Microsoft.Win32.RegistryValueKind.String);
I typed code from the head so maybe you would have to make some changes. And for this you need to have administrative rights on your application also.
Upvotes: 3