How to Read a registry value through VBScript.

Discussion in 'Scripting' started by Asif, Sep 19, 2003.

  1. Asif

    Asif Guest

    I have to read a registry value through VBScript.

    Key Name: HKEY_CURRENT_USER\Software\Olympus\DSSPlayer2002
    \Dictation Module\DownLoad\InstallSetting

    There are 6 values under this key name but I have to read
    the value data of following:

    Name: DownloadPath
    Data: C:\Program Files\Olympus\DSSPlayer2002
    \Message\Download Tray

    Since the value data can be different on different
    machines like D:\ instead of C:\

    So, I need a mechanism to read this through a short
    vbscript. Please reply me if you know the answer. Thanks

    Asif, Sep 19, 2003
    1. Advertisements

  2. Hi

    Set oShell = CreateObject("WScript.Shell")

    sRegKey = "HKCU\Software\Olympus\DSSPlayer2002" _
    & "\Dictation Module\DownLoad\InstallSetting\"

    sRegValue = "" ' init value in case value does not exist
    On Error Resume Next
    sRegValue = oShell.RegRead(sRegKey & "DownloadPath")
    On Error Goto 0

    WScript.Echo "Registry value is: " & sRegValue

    WSH 5.6 documentation (local help file) can be downloaded from here if you
    haven't got it already:
    Torgeir Bakken (MVP), Sep 19, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.