Registry Key renaming with VBScript and Regedit 
Author Message
 Registry Key renaming with VBScript and Regedit

Hi there,
i didnt find any solution for this in the groups but i did find a lot
of questions so i post a scripting solution to share.

' RenameRegKey.vbs
Option Explicit
Const ForWriting = 2

Dim tsRead 'As Scripting.TextStream
Dim tsWrite 'As Scripting.TextStream
Dim str 'As String
With CreateObject("WScript.Shell")
        .Run "regedit /e:a Old.reg ""HKEY_LOCAL_MACHINE\Software\TestOld""",
, True
End With
With CreateObject("Scripting.FileSystemObject")
        Set tsWrite = .OpenTextFile("New.reg", ForWriting, True)
        With tsWrite
                .WriteLine "REGEDIT4"
                .WriteBlankLines 1
                .WriteLine "[-HKEY_LOCAL_MACHINE\Software\TestOld]"
        End With
        Set tsRead = .OpenTextFile("Old.reg")
        With tsRead
                While Not .AtEndOfStream
                        str = .ReadLine
                        If str <> "REGEDIT4" Then
                                tsWrite.WriteLine Replace(str,
                        End If
        End With
        Set tsWrite = Nothing
        Set tsRead = Nothing
End With
With CreateObject("WScript.Shell")
        .Run "regedit /s New.reg", , True
End With

Fri, 06 May 2005 23:10:47 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Renaming or copying a registry key and its sub-keys

2. Rename devices registry keys

3. Rename Registry Key (NOT VALUE)

4. How to rename a key in the Registry

5. Renaming Registry key through Visual basic

6. Renaming Registry Key

7. Renaming a Registry key

8. rename registry key

9. Q:Rename Registry key

10. How do you Rename a Registry Keys?

11. Rename registry key

12. Renaming a Registry Key


Powered by phpBB® Forum Software