Written by James McDonald

June 5, 2013

Thinking of storing settings in registry. Some sample code:

set oshell = createobject("wscript.shell")

apf = "HKEY_LOCAL_MACHINE\SOFTWARE\Settings"
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", _
				"REG_SZ"
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_domain" , _
				"domainname", _
				"REG_SZ"
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_password" , _
				"secret_password", _
				"REG_SZ"
oshell.regwrite "HKLM\SOFTWARE\APFoods\edi_transfer_host" , _
				"remote_host", _
				"REG_SZ"

set d = createobject("Scripting.Dictionary")

for each i in settings

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

next

for each j in d.items

	wscript.echo j

next

for each k in d.keys

	wscript.echo d.item(k)

next

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Robocopy exclude Directories

Just trying to copy everything except a couple of directories from a drive to my NAS This is the secret incantation of...