How to check for registry value using VbScript

前端 未结 5 1723
我寻月下人不归
我寻月下人不归 2020-12-30 06:15

How can I check for registry value using VbScript?

5条回答
  •  礼貌的吻别
    2020-12-30 06:39

       function readFromRegistry (strRegistryKey, strDefault )
        Dim WSHShell, value
    
        On Error Resume Next
        Set WSHShell = CreateObject("WScript.Shell")
        value = WSHShell.RegRead( strRegistryKey )
    
        if err.number <> 0 then
            readFromRegistry= strDefault
        else
            readFromRegistry=value
        end if
    
        set WSHShell = nothing
    end function
    

    Usage :

    str = readfromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\ESD\Install_Dir", "ha")
    wscript.echo "returned " & str
    

    Original post

提交回复
热议问题