'________________________________________________________________ [ header ] __ ' Cerro Scripts: regexists.vbs ' ' Copyright (c) 2005 Philipp Föckeler (www.cerrotorre.de) ' ' Check key/value existence in registry ' Function RegExists(regPath) Dim wso, value, errString On Error Resume Next ' deactivate runtime errors RegExists = False ' set default=False Set wso = CreateObject("Wscript.Shell") If (Right(regPath, 1) <> "\") Then ' check for Reg Value value = wso.RegRead(regPath) ' try to read If (Err.Number=0) Then RegExists = True Else ' check for Reg Key value = wso.RegRead("HKLM\Dummy\") ' get the description text errString = Replace(Err.Description, """HKLM\Dummy\"".", "") value = wso.RegRead(regPath) ' try to read If (Err.Number=0) Then ' success? RegExists = True Else ' or same description ? If Replace(Err.Description, """" & regPath &""".", "") <> errString Then RegExists = True End If End If End If Set wso = Nothing On Error Goto 0 End Function