我试图使用VBScript枚举某些注册表项的实际值,但遇到了一个奇怪的问题。
来自前一个子节点的这个脚本工作正常,并且在停靠'''''''''''''''''''
时,脚本正在检索每个子键的实际值:
strOfficePath = "Software\Microsoft\Office\15.0\"
strKeysuffix = "\Resiliency\DisabledItems\"
objReg.EnumKey conHKEY_CURRENT_USER, strOfficePath, arrOfficeSubKeys
For Each key in arrOfficeSubKeys
If regExists("HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\" & key & strKeysuffix) Then
objReg.EnumValues conHKEY_CURRENT_USER, strOfficePath & key & strKeysuffix, arrKeyValues
For Each value in arrKeyValues
'''''''''''''''''''''
If value <> "" Then
objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\" & key & "\Resiliency\DisabledItems\" & value
End If
Next
End If
Next
但是,在这个脚本中,我留下了相同的标记,我只获取每个子项的名称,但不是这些键中的实际值......
Dim readreg, strReadPath
strDazzleSitePath = "Software\Citrix\Dazzle\Sites\"
objReg.EnumKey conHKEY_CURRENT_USER, strDazzleSitePath, arrDazzleSiteKeys
For Each key in arrDazzleSiteKeys
objReg.EnumValues conHKEY_CURRENT_USER, strDazzleSitePath & key & "\", arrKeyValues
For Each value in arrKeyValues
'''''''''''''''''''''
Set strReadPath = "HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\" & key & "\" & value
Set readreg = objShell.regRead(strReadPath)
If instr(readreg, "XenApp7") Then
' Log the user name etc somewhere
Exit Sub
End If
Next
Next
有人可以解释一下这里发生了什么吗?
答案 0 :(得分:0)
我仍然不知道这里发生了什么,但我解决了这个问题:
On Error Resume Next
Dim readreg, strReadPath
strDazzleSitePath = "Software\Citrix\Dazzle\Sites\"
objReg.EnumKey conHKEY_CURRENT_USER, strDazzleSitePath, arrDazzleSiteKeys
For Each key in arrDazzleSiteKeys
objReg.EnumValues conHKEY_CURRENT_USER, strDazzleSitePath & key, arrKeyValues
For Each value in arrKeyValues
objReg.GetStringValue conHKEY_CURRENT_USER, strDazzleSitePath & key, value, strValue
If instr(strValue, "XenApp7") Then
' Log the user name etc somewhere
Exit Sub
End If
Next
Next
现在strValue将包含每个子键值的字符串值。