RegRead / RegWrite VBS

Written by James McDonald

June 5, 2013

Thinking of storing settings in registry. Some sample code:

set oshell = createobject("")

settings = Array("user", "domain", "password", "host")
slug = apf & "\edi_transfer_"

' create APFoods key 
oshell.regwrite "HKLM\SOFTWARE\APFoods\" , "", "REG_SZ"

' create values
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_user" , _
				"username", _
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_domain" , _
				"domainname", _
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_password" , _
				"secret_password", _
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_host" , _
				"remote_host", _

set d = createobject("Scripting.Dictionary")

for each i in settings

		d.add i , oshell.regread(slug & i)


for each j in d.items

	wscript.echo j


for each k in d.keys

	wscript.echo d.item(k)



Submit a Comment

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

You May Also Like…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...


Just downloaded WizTree (not a sponsor) from It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...