Scripting Home > Code Snippets

Reading Registry Values Popular

Language: VBScript

Version: 1.0 (June 8, 2005)

Download: regread.vbs (Use "Save Target As..." with IE5.5)

This example script shows how to read simple values from the Windows registy.

To copy the script either use the download link above or cut and paste the following code into a text document and name it regread.vbs

' Begin code for regread.vbs
' Downloaded from the Scripting Guide for Windows
' Version: 1.0 (June 8, 2005)

Option Explicit

Dim WSHShell, RegKey, ScreenSaver

Set WSHShell = CreateObject("WScript.Shell")

RegKey = "HKCU\Control Panel\Desktop\"

ScreenSaver = WSHShell.RegRead(RegKey & "SCRNSAVE.EXE")

WScript.echo "Screen Saver: " & ScreenSaver

' End code

Disclaimer: This information is provided on an "as is" basis and all risk is with you. PC Tools Limited makes no warranties, express, implied or statutory, as to any matter whatsoever.