I am trying to read the the names of registry keys under(HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\).
I can get them using regobj.dll, but i would like to use WSH to get them. Any ideas?
Function RegKeyExists(key)
Dim keyExists,scrap,shell
Set shell=CreateObject("WScript.Shell"
keyExists=true
On Error Resume Next
scrap=shell.RegRead(key)
If Err.Number<>0 Then
RegKeyExists=0
If Left(Err.Description,1)<>"I" Then RegKeyExists=1
Err.Clear
Else
RegKeyExists=-1
End If
On Error Goto 0
End Function
then,
If RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\<some_Key\value>" Then
somevar=shell.RegRead "HKEY_LOCAL_MACHINE\SOFTWARE\<some_key\value>"
end if
hi cornboy88
I have a very similar task and the answers you got seem
not to work. The first one does not work, because the
regedit.exe is not in WINNT\system, which is in the default
PATH variable (my script must work with all default), and
the second is imho no answer to the question.
I'd expect that there is a method to get an array of all the
keys under a specified key whithout knowing their names.
Have you got an answer to this? If so, I'd appreciate to
get it.
Thanx
Peter
Dim f1 'fso info
Dim sTest 'string used to test
Dim sMyPos 'string used for the name
Dim sMyPos1 'string used for the name
Dim iNum 'number for length of string
Dim sData 'holds the display name
Dim sFinal 'end result of loop
Dim oWS : Set oWS = CreateObject("WScript.Shell"
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject"
You also could use the RegObj.dll that can be downloaded from Microsoft (google for regobji.exe or so).
The code looks like this (just a short example that lists all dial up connections, so you have to do some extra work):
Dim objRegistry, objRegKey
Set objRegistry = CreateObject("RegObj.Registry"
Set objRegKey = objRegistry.RegKeyFromString("\HKEY_CURRENT_USER\RemoteAccess\Profile\"
For Each objRegKey In objRegKey.SubKeys
WScript.Echo(objRegKey.name)
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.