Pages

Wednesday, 19 October 2011

QTP Script: Delete a key from the registry.


' =============================================================
' function: RegistryDelete
' desc :    Deletes a key from the registry
' params :  strRoot is the root key, i.e. "HKLM", "HKCU"
'           strPath is the path to delete, i.e. 
'           "Software\Test\Automation"
' returns : void
' =============================================================
Function RegistryDelete(strRootstrPath)

' create the shell object
Set objShell = CreateObject("WScript.Shell")

' delete the key
strValue = objShell.RegDelete(strRoot & "\" & strPath)

' destroy the object
Set objShell = Nothing

End Function 'RegistryDelete


0 comments:

Post a Comment