CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    26

    Usage of regedit in C#

    Hi All,

    How can i export windows registry using C#.

    pls

  2. #2
    Join Date
    Jul 1999
    Location
    Malmö, Sweden
    Posts
    126

    Re: Usage of regedit in C#

    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.

    Code:
       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!
    Last edited by Anders; April 25th, 2005 at 12:19 PM. Reason: Added note about Windows 95/98/Me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured