Pages

Wednesday, 19 October 2011

QTP Script: Write a value to the Registry


' =============================================================
' Sub :    RegistryWrite
' desc :   Writes a key value to the registry
' params : strRoot is the root key, i.e. "HKLM", "HKCU"
'          strPath is the path to create, i.e. 
'          "Software\Test\Automation"
'          strValue is the value to write in the key
' returns : void
' =============================================================
Function RegistryWrite(strRootstrPathstrValue)

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

' write the key
objShell.RegWrite strRoot & "\" & strPathstrValue"REG_SZ"

' destroy the object
Set objShell = Nothing

End Function 'RegistryWrite

0 comments:

Post a Comment