Click to See Complete Forum and Search --> : Usage of regedit in C#


rajanikumar922
April 25th, 2005, 08:36 AM
Hi All,

How can i export windows registry using C#.

pls

Anders
April 25th, 2005, 12:18 PM
Hi, it is a well known secret (?) that you can export registry keys from the command line prompt by typing

regedit /e outputfile "regkey"

Apparently it is important to surround regkey with ".

So, if you can use the command line prompt to export registry keys, you can use C# to do it. How? With System.Diagnostics.Process.


System.Diagnostics.Process RegistryExportProcess = new System.Diagnostics.Process();
RegistryExportProcess.StartInfo.Arguments =
"/e c:\\regexp.reg \"HKEY_CURRENT_USER\\Software\\Microsoft\\HyperTerminal\"";
RegistryExportProcess.StartInfo.FileName = "regedit";
RegistryExportProcess.Start();


Note: I'm not sure if this is valid for Windows 95/98/Me though.

HTH!