如何使用VbScript检查注册表值

前端之家收集整理的这篇文章主要介绍了如何使用VbScript检查注册表值前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何使用VbScript检查注册表值?
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

用法

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

Original post

原文链接:https://www.f2er.com/windows/372231.html

猜你在找的Windows相关文章