This is clear: if your try to read a registry entry which doesn't
exists, the RegRead-methods fails (unfortunately with a misleading
error text). You need to do the following:
In VBScript try:
On Error resume next
wsh.RegRead (.......)
If err <> 0 Then
WScript.Echo "Entry doesn't exists"
WScript.Quit()
End if
In JScript there is currently no Err-Object available (the Script engine
5.0 will have such a try ... Get feature). For my own purposes I wrote a
small ActiveX allowing me to use the WSHKeyExists-methode.
This ActiveX-Control and other techniques will be available to the public in
Jan 99 in:
MS Press "Inside the Windows Scripting Host"
Currently the book is just scheduled for MS Press Germany, but
I'm optimistic that there is enought response from Script-programmers
to convince MS Press USA to do the project also in English ;-)
Gnter Born
http://ourworld.compuserve.com/homepages/Guenter_Born
Gnter Born
http://ourworld.compuserve.com/homepages/Guenter_Born
Robert Burbidge <{NOSPAM}> schrieb in Nachricht
Quote:
>I'm having problems with the RegRead method of the Wscript.WShell object.
>RegWrite seems to work ok, as does RegDelete, but any attempt to call
>RegRead results in an error message to the effect that the file cannot be
>located.
>Does anyone have experience of a similar problem? This is under NT
>Workstation SP3, Windows scripting host 1.0. I have admin rights and can
>read the registry using regedit without problems.
>Thanks in advance
>Robert Burbidge
>Remove the {NOSPAM} for return e-mail.