I have some troubles with my code (see bellow). I would like to check if
this Key exists or not. In the docmentation I have followed (I think) the
procedure but for no reason it dosen't work?.
Thanks
Luigi
My code :
Dim varrecup
Set WshShell = WScript.CreateObject("WScript.Shell")
varrecup=WshShell.RegRead("HKLM\SOFTWARE\Object Design
Inc.\ObjectStore\5.1\")
You have to examine the err.description (a somewhat ugly solution):
In case (a) the description is:
Invalid root in registry key "HKEY_CURRENT_USER\Software\BlahBlah\".
In case (b) it's:
Unable to open registry key "HKEY_CURRENT_USER\Software\" for reading.
So use somthing like this after the RegRead:
If err then
if left(err.description,7) = "Invalid" then
'not found...
elseif left(err.description,6) = "Unable" then
'no default value set, but key exists...
else
'unexpected error
end if
end if
--
Michael Harris
MVP Scripting
"Luigi Bennardi" <lui...@ctech.ca> wrote in message news:O1boUus2$GA.271@cppssbbsa04...
For my understanding :
Case 1 : If I have a key with no defined value.... I will get an error
message "Unable to open ..."
Case 2 : If I have a key with a value (1,REG_DWORD)... I will get my value
... not the name of my KEY. So my question is can we get key name trough
vbs
Case 3: If I have a bad root...... I will get an error message "Invalid root
PS : sorry for my bad English.
Luigi
"Luigi Bennardi" <lui...@ctech.ca> wrote in message news:...
===> correct...
Case 2 : If I have a key with a value (1,REG_DWORD)... I will get my value
... not the name of my KEY.
===> correct
So my question is can we get key name trough
vbs
===> you need the key name to do the RegRead to start with. If you mean discovering the names of
subkeys or named values, RegRead doesn't support it.
Case 3: If I have a bad root...... I will get an error message "Invalid root
===> correct