Deleting a registry key
In a msi I am trying to delete a registry key (with all subkeys and values).
I don't know how many subkeys and values are existing.
First I have tried to do it with the RemoveRegistry tabelle, but there it is
necessary to define each singel item.
Than I have tried it with a custom action:
'--------------------------------------------------------
Sub DeleteKey (key) ' key is the keyname
Const tmpFolder = 2
Const ForWriting = 2
Dim oFso, oFile
Dim tmp, path
Set oFso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject ("WScript.Shell")
tmp = oFso.GetTempName
path = oFso.GetSpecialFolder(tmpFolder)
tmp = path & "\" & tmp
Set oFile = oFso.OpenTextFile(tmp, ForWriting, true)
oFile.WriteLine ("Windows Registry Editor Version 5.00")
oFile.WriteLine ("")
oFile.WriteLine ("[-" & key & "]")
oFile.WriteLine ("@=""""")
oFile.Close
Set oFile = Nothing
command = "C:\WINDOWS\Regedit.exe /s """ & tmp & """"
WshShell.Run command, 4, true
msgbox command
' oFso.DeleteFile tmp
End Sub
'--------------------------------------------------------
This will not work inside a msi. If I am using the command manually in an
cmd window (same syntax, same file) than it is working.
Are there some other ideas to resolve this task ?
Axel
|