Computers & ProgrammingComputers & NetworkingVBScript

Accessing the Local Registry Using VBScript

Accessing the local registry is quite easy using VBScript. Here are some examples on how to read, write, and delete information from the local registry.

RegRead Syntax


dim objShell
set objShell=CreateObject("")
strProductName=objShell.RegRead("HKLM\Software\" &_"Microsoft\Windows NT\CurrentVersion\ProductName")
wscript.echo "Your computer is running " & strProductName

More information on the RegRead Method:

RegWrite Syntax

object.RegWrite(strName, anyValue [,strType])

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\itgeared\Appname\",  &_"SomeString", "REG_SZ"

More information on the RegWrite Method:

RegDelete Syntax


Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKCU\Software\itgeared\Appname\"

More information on the RegDelete Method:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top