locked
How do I add to the registry? RRS feed

  • Question

  • I don't really know how else to say it, I have some registry files and i'm trying to make a program that adds what's in the files to the registry.
    Friday, June 16, 2006 3:16 AM

Answers

  • If you simply want to run the reg file to update the registry

    System.Diagnostics.Process.Start("d:\test.reg")

    Will work were d:\test.reg is you registry file.

    It will bring up the confirmation dialog just as though you had used regedit to import the registry file.

     

    Friday, June 16, 2006 3:30 AM
  • You can use the following code to import a .reg file without any prompt for confirmation.

     

    Public Sub ImportRegistry(ByVal strRegFile As String)

    Dim strRegedit As String

    Dim strArguments As String

    strRegedit = System.Environment.GetEnvironmentVariable("WinDir") & "\regedit.exe"

    strArguments = "/s """ & strRegFile & """"

    System.Diagnostics.Process.Start(strRegedit, strArguments)

    End Sub

    Friday, June 16, 2006 4:51 AM

All replies

  • If you simply want to run the reg file to update the registry

    System.Diagnostics.Process.Start("d:\test.reg")

    Will work were d:\test.reg is you registry file.

    It will bring up the confirmation dialog just as though you had used regedit to import the registry file.

     

    Friday, June 16, 2006 3:30 AM
  • You can use the following code to import a .reg file without any prompt for confirmation.

     

    Public Sub ImportRegistry(ByVal strRegFile As String)

    Dim strRegedit As String

    Dim strArguments As String

    strRegedit = System.Environment.GetEnvironmentVariable("WinDir") & "\regedit.exe"

    strArguments = "/s """ & strRegFile & """"

    System.Diagnostics.Process.Start(strRegedit, strArguments)

    End Sub

    Friday, June 16, 2006 4:51 AM