本帖最后由 WHY 于 2021-1-28 22:34 编辑
| Rem On Error Resume Next | | Const HKLM = &H80000002 | | Dim regPath, objReg | | regPath = "Software\Microsoft\Windows\CurrentVersion" | | Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\Root\Default:StdRegProv") | | | | EnumRegistry HKLM, regPath | | | | Function EnumRegistry(HKLM, regSubPath) | | Dim arrName, arrType, s, i, regType, regValue | | objReg.EnumValues HKLM, regSubPath, arrName, arrType | | If isArray(arrName) Then | | s = "" | | For i=0 To UBound(arrName) | | regType = GetRegType(arrType(i)) | | regValue = GetRegValue( HKLM, regSubPath, arrName(i), arrType(i) ) | | s = s & arrName(i) & vbTab & regType & vbTab & regValue & vbLf | | Next | | WSH.Echo regSubPath & vbLf & s | | Else | | WSH.Echo regSubPath | | End If | | | | objReg.EnumKey HKLM, regSubPath, arrName | | If isArray(arrName) Then | | For i=0 To UBound(arrName) | | EnumRegistry HKLM, regSubPath & "\" & arrName(i) | | Next | | End If | | End Function | | | | Function GetRegType(n) | | Select Case n | | Case 1 GetRegType = "REG_SZ" | | Case 2 GetRegType = "REG_EXPAND_SZ" | | Case 3 GetRegType = "REG_BINARY" | | Case 4 GetRegType = "REG_DWORD" | | Case 7 GetRegType = "REG_MULTI_SZ" | | Case 11 GetRegType = "REG_QWORD" | | End Select | | End Function | | | | Function GetRegValue( HKLM, regSubPath, regName, n ) | | Select Case n | | Case 1 | | objReg.GetStringValue HKLM, regSubPath, regName, sValue | | GetRegValue = sValue | | Case 2 | | objReg.GetExpandedStringValue HKLM, regSubPath, regName, sValue | | GetRegValue = sValue | | Case 3 | | objReg.GetBinaryValue HKLM, regSubPath, regName, uValue | | GetRegValue = Join(uValue, ",") | | Case 4 | | objReg.GetDWORDValue HKLM, regSubPath, regName, uValue | | GetRegValue = uValue | | Case 7 | | objReg.GetMultiStringValue HKLM, regSubPath, regName, sValue | | GetRegValue = Join(sValue, ",") | | Case 11 | | objReg.GetQWORDValue HKLM, regSubPath, regName, uValue | | GetRegValue = uValue | | End Select | | End FunctionCOPY |
|