I am trying to import a registry value that was saved previously thru C#. Regedit runs each time I import, but the value doesnt change. The only difference I get when running as administrator or not is the UAC prompt for regedit when not elevated. Regedit still seems to run, but it seems to not be reading and importing the .reg file.
Import:
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string FullPath = openFileDialog1.FileName;
MessageBox.Show(Convert.ToString(FullPath));
Process regeditProcess = Process.Start("regedit.exe", "/s" + FullPath);
regeditProcess.WaitForExit();
}
return;
}
Problem could be if FullPath
have spaces in it.
Instead of:
Process regeditProcess = Process.Start("regedit.exe", "/s" + FullPath);
try this:
Process regeditProcess = Process.Start("regedit.exe", "/s \"" + FullPath + "\"");