Copy codeThe Code is as follows: 'hardware _ Info. vbs v1.1 BY: fastslz
On Error Resume Next
Dim WMI, WS, Fso
Set WMI = GetObject ("Winmgmts: {impersonationLevel = impersonate }! \. \ Root \ cimv2 ")
Set cOSs = WMI. ExecQuery ("Select * from Win32_OperatingSystem ")
For Each oOS in cOSs
OSx = oOS. Caption & "& oOS. CSDVersion & vbCrLf
Next
BBx = "------------ motherboard information ------------" & vbCrLf
Set Board = WMI. InstancesOf ("Win32_BaseBoard ")
Set Bios = WMI. InstancesOf ("Win32_Bios ")
For Each oBoard In Board
BBx = BBx _
& "Motherboard name:" & oBoard. Product & vbTab & oBoard. Version & vbCrLf _
& "Manufacturer:" & oBoard. Manufacturer & vbCrLf
Next
For Each oBios In Bios
BBx = BBx _
& "BIOS vendor:" & oBios. Manufacturer & vbCrLf _
& "BIOS Date:" & FormatDateTime (wDate (Trim (oBios. ReleaseDate), 1) & vbCrLf _
& "BIOS version:" & oBios. SMBIOSBIOSVersion & vbCrLf _
& "OEM Version:" & oBios. Version & vbCrLf
Next
Set Bios = Nothing: Set Board = Nothing
CPUx = "----------- processor information -----------" & vbCrLf
Set CPUs = WMI. InstancesOf ("Win32_Processor ")
Set Caches = WMI. InstancesOf ("Win32_CacheMemory ")
For Each ObjCPU In CPUs
MCS = ObjCPU. MaxClockSpeed: CCS = ObjCPU. CurrentClockSpeed
If ObjCPU. MaxClockSpeed Mod 2 = 1 Then MCS = CCS + 1
If ObjCPU. CurrentClockSpeed Mod 2 = 1 Then CCS = CCS + 1
OC = QOC (CCS, MCS)
If (OC-MCS)> 10 and (OC-MCS)> 0 Then OCLC = "overclocking ratio:" & FormatPercent (OC-MCS)/MCS)
If (OC-MCS) <-10 and (OC-MCS) <0 Then OCLC = "Frequency reduction ratio:" & FormatPercent (OC-MCS)/MCS)
CPUx = CPUx _
& "CPU Name:" & Trim (ObjCPU. Name) & vbCrLf _
& "CPU architecture:" & ObjCPU. Description & vbCrLf _
& "Manufacturer:" & ObjCPU. Manufacturer & vbCrLf _
& "Interface specification:" & ObjCPU. SocketDesignation & vbCrLf _
& "CPU quantity:" & ObjCPU. CpuStatus & vbCrLf _
& "Core quantity:" & ObjCPU. NumberOfCores & vbCrLf _
& "Thread count:" & ObjCPU. NumberOfLogicalProcessors & vbCrLf _
& "Address width:" & ObjCPU. AddressWidth & "Bit" & vbCrLf _
& "Data Bit Width:" & ObjCPU. DataWidth & "Bit" & vbCrLf _
& "CPU voltage:" & ObjCPU. CurrentVoltage/10 & "V" & vbCrLf _
& "External frequency:" & ObjCPU. ExtClock & "MHz" & vbCrLf _
& "Current frequency:" & OC & "MHz" & OCLC & vbCrLf _
& "Original frequency:" & MCS & "MHz" & vbCrLf _
& "CPU usage:" & ObjCPU. LoadPercentage & "%" & vbCrLf
Next
Function QOC (CCS, MCS)
If CCS = MCS Then
Set wReg = GetObject ("winmgmts: {impersonationLevel = impersonate }! \. \ Root \ default: StdRegProv ")
WReg. GetDWORDValue & H80000002, "HARDWARE \ DESCRIPTION \ System \ CentralProcessor \ 0 ","~ MHz ", strValue
OC = strValue: Set wReg = Nothing
Else
OC = CCS
End If
QOC = OC: If QOC Mod 2 = 1 Then QOC = QOC + 1
End Function
For Each ObjCache In Caches
If objCache. MaxCacheSize> 0 Then
Select Case objCache. Purpose
Case "L1-Cache"
CPUx = CPUx & "primary cache:" & objCache. MaxCacheSize & "KB (L1 Data + L1 cache)" & vbCrLf
Case "L2-Cache"
CPUx = CPUx & "Level 2 Cache:" & objCache. MaxCacheSize & "KB" & vbCrLf
Case "L3-Cache"
CPUx = CPUx & "Level 3 cache:" & objCache. MaxCacheSize & "KB" & vbCrLf
End Select
End If
Next
Set Caches = Nothing: Set CPUs = Nothing
Memx = "------------ memory information ------------" & vbCrLf
Set Memorys = WMI. InstancesOf ("Win32_PhysicalMemory ")
Set MemKY = WMI. InstancesOf ("Win32_OperatingSystem ")
For Each aKY In MemKY
ZL = aKY. TotalVisibleMemorySize
KY = aKY. FreePhysicalMemory
Next
Mems = 0: Memc = 0
Types = Array ("Unknown", "Other", "DRAM", "Synchronous DRAM", "Cache DRAM", "EDO", "EDRAM", "VRAM ", "SRAM", "RAM ",_
"ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3 DRAM", "SDRAM", "SGRAM ", "RDRAM", "DDR", "DDR2 ")
For Each Mem In Memorys
For I = 0 To UBound (Types)
If Mem. MemoryType = I Then MemType = Types (I): End If
Next
For j = 0 To 6
Select Case Mem. Tag
Case "Physical Memory" & j
Mems = Mems + (Mem. Capacity)
Memx = Memx & "slot" & Mem. DeviceLocator & ":" & Round (Mem. Capacity/1048576) & "MB "_
& MemType & "-" & Mem. Speed & "MHz" & "data bandwidth" & Mem. DataWidth _
& "Bit" & "Total Bandwidth" & Mem. TotalWidth & "Bit" & vbCrLf
End Select
Next
Next
Memx = Memx _
& "Memory installation:" & Round (Mems/1048576) & "MB" & vbCrLf _
& "Total memory:" & Round (ZL/1024) & "MB" & vbCrLf _
& "Memory available:" & Round (KY/1024) & "MB" & vbCrLf _
& "Memory usage:" & FormatPercent (ZL-KY)/ZL) & vbCrLf
Set Memorys = Nothing: Set MemKY = Nothing
Vx = "------------ video card information ------------" & vbCrLf
Set cVID = WMI. ExecQuery ("SELECT DeviceID FROM Win32_VideoController ")
For Each oVID In cVID
Set Video = WMI. ExecQuery ("SELECT * FROM Win32_VideoController WHERE DeviceID = '" & oVID. DeviceID &"'")
For Each oVideo In Video
Vx = Vx _
& "Video Card Name:" & oVideo. Name & vbCrLf _
& "Manufacturer:" & oVideo. AdapterCompatibility & vbCrLf _
& "Physical memory:" & Round (oVideo. AdapterRAM/1048576) & "MB" & vbCrLf _
& "Display Mode:" & oVideo. CurrentHorizontalResolution & "X "_
& OVideo. CurrentVerticalResolution &""_
& Amp; oVideo. CurrentBitsPerPixel & amp; "Bit "_
& OVideo. CurrentRefreshRate & "Hz" & vbCrLf
Next
Next
Set Video = Nothing: Set cVID = Nothing
Dx = "------------ hard disk information ------------" & vbCrLf
Set IDE = WMI. ExecQuery ("Select * from Win32_DiskDrive WHERE InterfaceType = 'ide '")
Set cPPP = WMI. ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk ")
For Each oIDE In IDE
For I = 0 To IDE. Count
Select Case oIDE. Index
Case I
For Each oPPP In cPPP
If InStr (oPPP. Name, I) Then vName = oPPP. Name
Next
Dx = Dx & "Hard Drive" & I & "model:" & oIDE. Caption & vbCrLf _
& VbTab & "nominal capacity:" & Round (oIDE. Size/1000000000) & "GB" & vbCrLf _
& VbTab & "actual capacity:" & Round (oIDE. Size/1073741824) & "GB" & vbCrLf _
& VbTab & "Number of cylinders:" & oIDE. TotalCylinders & vbCrLf _
& VbTab & "head quantity:" & oIDE. TotalHeads & vbCrLf _
& VbTab & "number of sectors per sector:" & oIDE. SectorsPerTrack & vbCrLf _
& VbTab & "slice size:" & oIDE. BytesPerSector & vbCrLf _
& VbTab & "Total slice count:" & oIDE. TotalSectors & vbCrLf _
& VbTab & "partition status:" & vName & vbCrLf
DevID = Replace (oIDE. DeviceID ,"\","\\")
Set cDP = WMI. ExecQuery ("associators of {Win32_DiskDrive.DeviceID =" & DevID &"""}"_
& "WHERE AssocClass = Win32_DiskDriveToDiskPartition ")
For Each oDP In cDP
Set cLD = WMI. ExecQuery ("associators of {Win32_DiskPartition.DeviceID =" & oDP. DeviceID &"""}"_
& "WHERE AssocClass = Win32_LogicalDiskToPartition ")
For Each oLD In cLD
Dx = Dx _
& VbTab & oLD. DeviceID & "& Left (oLD. VolumeName &" ", 11) & Left (oLD. FileSystem &", 6) & "Total :"_
& Right ("& Round (oLD. Size/latest 3741824,1), 6) &" GB available :"_
& Right ("& Round (oLD. FreeSpace/found 3741824,1), 6) &" GB used :"_
& Right ("& Round (oLD. Size-oLD.FreeSpace)/g03741824,1), 6) &" GB "& vbCrLf
Next
Next
End Select
Next
Next
Set cLD = Nothing: Set cDP = Nothing: Set IDE = Nothing: Set cDP = Nothing: Set cPPP = Nothing
Sx = "------------ sound card information ------------" & vbCrLf
Set cSD = WMI. ExecQuery ("SELECT * FROM Win32_SoundDevice ")
For Each oSD In cSD
Sx = Sx & "Sound Card Name:" & oSD. ProductName & vbCrLf
Next
Set cSD = Nothing
Nx = "------------ Nic information ------------" & vbCrLf
Set cNet = WMI. ExecQuery ("Select * from Win32_NetworkAdapter WHERE PhysicalAdapter = 'true '")
If CStr (cNet. Count) <0 Then
Set cNet = WMI. ExecQuery ("Select * from Win32_NetworkAdapter WHERE PNPDeviceID Like 'pci % 'or PNPDeviceID Like 'usb % '")
For Each oNet In cNet
If oNet. NetConnectionStatus> 0 Then
Nx = Nx & "Nic Name:" & oNet. Name & vbCrLf
Else
Nx = Nx & "Nic Name:" & oNet. Name & vbCrLf
End If
Next
Else
For Each oNet In cNet
If oNet. NetEnabled = TRUE Then
Nx = Nx & "Nic Name:" & oNet. Name & vbTab & "active" & vbCrLf
Else
Nx = Nx & "Nic Name:" & oNet. Name & vbTab & "idle" & vbCrLf
End If
Next
End If
Set cNet = Nothing
If (Lcase (Right (Wscript. FullName, 11) = "wscript.exe") Then
MsgBox OSx & BBx & CPUx & Memx, "Hardware_Info.vbs v1.0 BY: fastslz"
MsgBox Vx & Sx & Nx, "Hardware_Info.vbs v1.0 BY: fastslz"
MsgBox Dx, "Hardware_Info.vbs v1.0 BY: fastslz"
MsgN = MsgBox ("do you want to save it to a file? ", 32 + 4," Hardware_Info.vbs v1.0 BY: fastslz ")
If MsgN = 6 Then JZCSx = JZCS: wInfo
Else
WScript. Echo OSx & BBx & CPUx & Memx & Vx & Sx & Nx & Dx
End If
Set WMI = Nothing
Sub wInfo ()
Set WS = CreateObject ("WScript. Shell ")
Set Fso = CreateObject ("Scripting. FileSystemObject ")
AFile = WS. CurrentDirectory & "\" & WS. ExpandEnvironmentStrings ("% COMPUTERNAME %") & "_Hardware_Info.txt"
Set HInfo = Fso. CreateTextFile (aFile, True)
HInfo. WriteLine "Hardware_Info.vbs BY: fastslz"
HInfo. WriteLine OSx & BBx & CPUx & Memx & Vx & Sx & Nx & Dx & JZCSx
HInfo. Close
WS. Run Chr (34) & aFile & Chr (34)
Set WS = Nothing: Set Fso = Nothing: Set HInfo = Nothing
End Sub
Function wDate (nD)
If Not IsNull (nD) Then
WDate = CDate (Mid (nD, 5,2) & "/" & Mid (nD, 7,2) & "/" & Left (nD, 4) & "& Mid (nD, 9, 2) & ":" & Mid (nD, 11,2) & ":" & Mid (nD, 13,2 ))
End If
End Function
Function JZCS ()
NumMsg = vbCrLf & "----------- simple CPU Benchmark Test ---------" & vbCrLf
Dim I, T1, T2, Tempvalue, aRunTime, bRunTime
T1 = Timer ()
For 1 To 2000000
Tempvalue = 2 ^ 0.5
Next
T2 = Timer ()
ARunTime = FormatNumber (T2-T1) *, 2)
NumMsg = NumMsg & "time required for 2 million CPU operations:" & aRunTime & "millisecond" & vbCrLf
T1 = Timer ()
For 1 To 6000000
Tempvalue = 1 + 1
Next
T2 = Timer ()
BRunTime = FormatNumber (T2-T1) *, 2)
NumMsg = NumMsg & "CPU 6 million addition calculation time:" & bRunTime & "millisecond" & vbCrLf
JZCS = NumMsg
End Function
Cmd call MethodCopy codeThe Code is as follows: @ echo off
For/f "delims = *" % a In ('cscript // Nologo "Hardware_Info.vbs" ^ | find ":" ') do echo %
: Create a Backup folder in the first partition of the second hard disk.
For/f "tokens = 2, *" % a In ('cscript // Nologo "Hardware_Info.vbs" ^ | findstr "partition status" ') do (
If % a # = 1 # for/f "tokens = 1" % I In ("% B") do MD "% I \ Backup ")
Pause