我试图使用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有人能解释一下这是怎么回事吗?
发布于 2016-02-24 12:39:18
我仍然不知道这是怎么回事,但我解决了这个问题:
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将包含每个子键值的字符串值。
https://stackoverflow.com/questions/35602183
复制相似问题