does reg key exist--vbscript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to write a vbscript that checks if a specific key exists...but I
can't seem to figure out the right syntax -

for example, if OPEN1 exists, check OPEN2, check OPEN3, until it finds one
that does not exist, then write a specific value to it.

thanks
Jason
 
the easy way is to read the key and check for errors.
The more advanced way is to use wmi to get all subkeys and then loop through
that list
 
Jason said:
I'm trying to write a vbscript that checks if a specific key exists...but I
can't seem to figure out the right syntax -

for example, if OPEN1 exists, check OPEN2, check OPEN3, until it finds one
that does not exist, then write a specific value to it.
Hi,


See the RegKeyExists function in the scripts in the links below (for a
registry value exist test, see function RegValueExists).

With the WshShell's RegRead method ("pure" WSH code):
http://groups.google.co.uk/group/mi...ng.vbscript/msg/b66651407f7c3ec7?dmode=source

With WMI's StdRegProv class:
http://groups.google.co.uk/group/mi...r.scripting/msg/33b8f015b189a00d?dmode=source
 
Back
Top