主頁 > 知識庫 > VBS腳本寫的Windows硬件檢測工具分享

VBS腳本寫的Windows硬件檢測工具分享

熱門標(biāo)簽:地圖標(biāo)注政府哪個部門管 哪里有便宜的地圖標(biāo)注公司 百度地圖標(biāo)注點(diǎn)距離代碼 如何用機(jī)器人進(jìn)行電銷 東營快遞外呼系統(tǒng) 佛山真人電銷機(jī)器人廠家 除了地圖標(biāo)注還有這種生意嗎 齊齊哈爾高德地圖標(biāo)注店 神行者美術(shù)館地圖標(biāo)注
Const MyName = "Windows硬件檢視工具(測試版) --by:Rex.Pack(雷克斯.派)"

If Not LCase(Replace(WScript.FullName, WScript.Path  "\", "")) = "cscript.exe" Then
	Set WS = CreateObject("WScript.Shell")
	WS.Run "CMD /c mode con: cols=115  Color 0A  Title "  MyName  "  CScript //nologo """  WScript.ScriptFullName  """"
	WScript.Quit
End If
'----初始化
Set SD = CreateObject("Scripting.Dictionary")
	SD.CompareMode = vbTextCompare
Set S = New BaseStr
Set PC = New BasePC
Set WMI = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
CmdArr = Split(" OS CPU Board Memory Video Disk USB CacheMemory NetWork BIOS Sound Battery PortableBattery"  " S1 S2 S3 S4")
With SD
	.Add "?", "Call Menu"
	.Add "e", "WScript.Quit"
	For I = 1 To 17
		.Add CStr(I), CmdArr(I)
	Next
	.Add "a", "1-6"
	.Add "b", "7-9"
	.Add "c", "10-13"
	.Add "d", "14-17"
End With

Echo MyName

Call Menu
Call Main


'----CO
Sub Menu()
	Echo "[設(shè)備列表]"
	Echo " 常用組 A: 1.OS	2.CPU	3.主板	4.內(nèi)存	5.顯卡	6.硬盤"
	Echo " 次級組 B: 7.USB	8.緩存	9.網(wǎng)卡"
	Echo " 醬油組 C: 10.BIOS	11.聲卡	電池(12.內(nèi)部 13.便攜)"
	Echo "[測試CPU]"
	Echo " 測試組 D: 14.變量冪次方運(yùn)算	15.字符疊合	16.加法計算	17.疊加計算"
End Sub

Sub Main()
	Print ">": GetNum = Trim(InPut)
	With SD
		If .Exists(GetNum) Then
			If IsNumeric(GetNum) Then
				Echo Eval("PC."  .Item(GetNum))
			Else
				ArrLU = Split(.Item(GetNum), "-")
				For L = ArrLU(0) To ArrLU(1)
					Echo Eval("PC."  .Item(CStr(L)))
				Next
			End If
		Else
			Echo "#不支持的命令"
		End If
	End With
	
	If Not Err.Number = 0 Then Echo ">X": Err.Clear
	Call Main
End Sub



'DDC
Class BaseStr
	Private Strs
	
	Private Sub Class_Initialize()
		Strs = ""
	End Sub
	
	Private Sub Class_Terminate()
		Call Cls
	End Sub
	
	Public Sub Cls()
		Strs = Empty
	End Sub
	
	Public Property Let I(ByVal Str)
		If Left(Str, 1) = "☆" Then Str = Str  String(80, "=")
		Strs = Strs  vbCrLf  Str
	End Property
	
	Public Default Property Get I()
		I = Strs
		Cls
	End Property
End Class

Class BasePC
	Private DPS
	
	Private Sub Class_Initialize()
		DPS = 200
	End Sub
	
	Private Sub Class_Terminate()
		DPS = Empty
	End Sub
	
	Function S1()
		S1 = "變量冪次方運(yùn)算 "  DPS  "萬次用時:"  RT("TestVar = I ^ 2", DPS * 10000)
	End Function
	
	Function S2()
		S2 = "字符疊合 "  DPS  "000次用時:"  RT("TestVar = TestVar  vbTab", DPS * 1000)
	End Function
	
	Function S3()
		S3 = "加法計算 "  DPS  "萬次用時:"  RT("TestVar = 86 + 32", DPS * 10000)
	End Function
	
	Function S4()
		S4 = "疊加計算 "  DPS  "萬次用時:"  RT("TestVar = TestVar + I", DPS * 10000)
	End Function
	
	Private Function RT(ByVal MathExp, ByVal Num)
		Dim NowTimer, NewTimer, TestVar
		NowTimer = Timer
		For I = 1 To Num
			ExeCute MathExp
		Next
		NewTimer = FormatNumber((Timer - NowTimer) * 1000, 3, True, , False)  "ms"
		RT = NewTimer
		TestVar = Empty
	End Function
	
	Function BIOS()
		On Error Resume Next
		S.I = "☆[BIOS]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_BIOS")
			With TempObj
				S.I = "┣廠商		:"  .Manufacturer
				S.I = "┇日期		:"  .ReleaseDate
				S.I = "┇OEM 版本	:"  .Version
				S.I = "┇BIOS 版本	:"  .SMBIOSBIOSVersion
				S.I = "┇Major版本	:"  .SMBIOSMajorVersion
				S.I = "┇狀態(tài)		:"  .Status
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		BIOS = S
	End Function

	Function OS()
		On Error Resume Next
		S.I = "☆[操作系統(tǒng)]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj in WMI.InstancesOf("Win32_OperatingSystem")
			With TempObj
				S.I = "┣標(biāo)簽  :"  .Caption
				S.I = "┇CSDV  :"  .CSDVersion
				S.I = "┇版本  :"  .Version
				S.I = "┇RAM識別:"  .TotalVisibleMemorySize / 1024  "MB"
				S.I = "┇RAM可用:"  .FreePhysicalMemory / 1024  "MB"
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		OS = S
	End Function
	
	Function Board()
		On Error Resume Next
		S.I = "☆[主板]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_BaseBoard")
			With TempObj
				S.I = "┣標(biāo)簽:"  .Caption
				S.I = "┇編號:"  .Product
				S.I = "┇序號:"  .SerialNumber 
				S.I = "┇名稱:"  .Name
				S.I = "┇版本:"  .Version
				S.I = "┇廠商:"  .Manufacturer
				S.I = "┇狀態(tài):"  .Status
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		Board = S
	End Function
	
	Function CPU()
		On Error Resume Next
		S.I = "☆[CPU]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_Processor")
			With TempObj
				MCS = .MaxClockSpeed
				CCS = .CurrentClockSpeed
				If MCS Mod 2 = 1 Then MCS = CCS + 1
				If CCS Mod 2 = 1 Then CCS = CCS + 1
				If CCS = MCS Then
					Set SRP = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
					SRP.GetDWORDValue H80000002, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz", OC
					Set SRP = Nothing
				Else
					OC = CCS
				End If
				If OC Mod 2 = 1 Then OC = OC + 1
				FC = OC - MCS
				If FC > +10 Then OCLC = "超"
				If FC  -10 Then OCLC = "降"
				OCLC = OCLC  "頻比率:"  FormatPercent(FC / MCS, True, True)
				
				S.I = "┣CPU 名稱:"  Trim(.Name)
				S.I = "┇CPU 架構(gòu):"  .Description
				S.I = "┇制造廠商:"  .Manufacturer
				S.I = "┇插口規(guī)格:"  .SocketDesignation
				S.I = "┇CPU 數(shù)量:"  .CpuStatus  "	"  String(.CpuStatus, "※")
				S.I = "┇核心數(shù)量:"  .NumberOfCores  "	"  String(.NumberOfCores, "∷")
				S.I = "┇線程數(shù)量:"  .NumberOfLogicalProcessors  "	"  String(.NumberOfLogicalProcessors, "≈")
				S.I = "┇地址位寬:"  .AddressWidth  " Bit"
				S.I = "┇數(shù)據(jù)位寬:"  .DataWidth   " Bit"
				S.I = "┇CPU 電壓:"  .CurrentVoltage / 10  "V"
				S.I = "┇外部頻率:"  .ExtClock  " MHz"
				S.I = "┇當(dāng)前頻率:"  OC         " MHz, "  OCLC
				S.I = "┇原始頻率:"  MCS        " MHz"
				S.I = "┇CPU占用%:"  .LoadPercentage  "%"
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		CPU = S
	End Function

	Function CacheMemory()
		On Error Resume Next
		S.I = "☆[緩存內(nèi)存]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_CacheMemory")
			With TempObj
				If .MaxCacheSize > 0 Then
					Select Case .Purpose
						Case "L1 Cache" AddStr = "(+DataBit)"
						Case Else
					End Select
					S.I = "┇作用位:"  .Purpose  " ID:"  .DeviceID  ":"  .MaxCacheSize  "KB"  AddStr
					AddStr = ""
				End If
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		CacheMemory = S
	End Function

	Function Memory()
		On Error Resume Next
		TempArr = Split("Unknown Other DRAM Synchronous-DRAM Cache-DRAM EDO EDRAM VRAM SRAM RAM ROM Flash EEPROM FEPROM EPROM CDRAM 3DRAM SDRAM SGRAM RDRAM DDR DDR-2")
		S.I = "☆[內(nèi)存]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_PhysicalMemory")
			With TempObj
				S.I = "┣名稱/標(biāo)簽:"  .Name  "/"  .Caption
				S.I = "┇BL    :"  .BankLabel
				S.I = "┇槽    :"  .DeviceLocator
				S.I = "┇容量   :"  .Capacity / 1048576  "MB"
				S.I = "┇類型   :"  TempArr(.MemoryType)
				S.I = "┇速率   :"  .Speed  "MHz"
				S.I = "┇制造商  :"  .Manufacturer
				S.I = "┇熱插拔  :"  IIf(.HotSwappable = True, True, False)
				S.I = "┇總位寬  :"  .TotalWidth
				S.I = "┇數(shù)據(jù)位寬 :"  .DataWidth
				S.I = "┇部分序號 :"  .PartNumber
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		Memory = S
	End Function

	Function Video()
		On Error Resume Next
		TempArr1 = Split(" 其他 未知 CGA EGA VGA SVGA MDA HGC MCGA 8514A XGA Linear Frame Buffer"  Space(160 - 14)  "PC-98")
		TempArr2 = Split(" 其他 未知 隔行 逐行")
		S.I = "☆[顯卡]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_VideoController")
			With TempObj
				S.I = "┣接口   :"  TempArr1(.VideoArchitecture)
				S.I = "┇名稱   :"  .Name
				S.I = "┇標(biāo)簽   :"  .Caption
				S.I = "┇I(xiàn)D    :"  .DeviceID
				S.I = "┇GPU   :"  .VideoProcessor
				S.I = "┇制造商  :"  .AdapterCompatibility
				S.I = "┇物理顯存 :"  .AdapterRAM / 1048576  "MB"
				S.I = "┇掃描模式 :"  IIf(.CurrentScanMode = False, False, TempArr2(.CurrentScanMode))
				S.I = "┇分辨率  :"  .CurrentHorizontalResolution  " x "  .CurrentVerticalResolution
				S.I = "┇色位盤  :"  .CurrentBitsPerPixel  "Bit"
				S.I = "┇刷新率  :"  .CurrentRefreshRate  "Hz"  "("  .MinRefreshRate  "-"  .MaxRefreshRate ")"
				S.I = "┇驅(qū)動版本 :"  .DriverVersion
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		Video = S
	End Function

	Function Disk()
		On Error Resume Next
		S.I = "☆[硬盤]"
		For Each TempObj In WMI.InstancesOf("Win32_DiskDrive")
			With TempObj
				S.I = "┏[磁盤:"  .Index  "]━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
				S.I = "┇名稱  :"  .Name
				S.I = "┇標(biāo)簽  :"  .Caption
				S.I = "┇接口  :"  .InterfaceType
				S.I = "┇制造商 :"  .Manufacturer
				S.I = "┇序號  :"  .SerialNumber
				S.I = "┇介質(zhì)描述:"  .Description  "	"  "┇介質(zhì)類型:"  .MediaType
				S.I = "┇柱面數(shù) :"  .TotalCylinders  " 	"  "┇磁頭數(shù) :"  .TotalHeads
				S.I = "┇標(biāo)準(zhǔn)容量:"  FormatNumber(.Size / 1000000000, 2, True)  "GB"  "	"  "┇實際容量:"  FormatNumber(.Size / 1073741824, 2, True)  "GB"
				S.I = "┇分區(qū)數(shù)量:"  .Partitions
				S.I = "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
				S.I = "┣[分區(qū)]┳━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━┉"
				S.I = "┇ 索引	┇主分區(qū)┇容量(GB)	┇塊(大小x數(shù)量)		┇屬性"
				S.I = "┣━━━╋━━━╋━━━━━━━╋━━━━━━━━━━━╋━━━━━┉"
				For Each TempObj0 In WMI.InstancesOf("Win32_DiskPartition")
					If .Index = TempObj0.DiskIndex Then
						S.I = "┇ "  TempObj0.Index  _
						"	┇"  TempObj0.PrimaryPartition  _
						"	┇"  FormatNumber(TempObj0.Size / 1073741824, 2, True)  "GB"  _
						"	┇"  TempObj0.BlockSize  "x"  TempObj0.NumberOfBlocks  _
						" 	┇"  _
						TIf(TempObj0.BootPartition, "引導(dǎo),")  _
						TIf(TempObj0.HiddenSectors, "隱藏,")  _
						TIf(TempObj0.Bootable, "啟動.")
					End If
				Next
				S.I = "┣━━━┻━━━┻━━━━━━━┻━━━━━━━━━━━┻━━━━━┉"
				S.I = "┣[扇區(qū)]━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
				S.I = "┇磁道扇區(qū):"  .SectorsPerTrack
				S.I = "┇扇區(qū)大小:"  .BytesPerSector
				S.I = "┇總扇區(qū)數(shù):"  .TotalSectors
				S.I = "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
			End With
		Next
		
		TempArr = Split("未知 可移動磁盤 本地磁盤 網(wǎng)絡(luò)驅(qū)動器 光盤 RAM磁盤   ")
		S.I = "┏[分區(qū)信息]━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
		For Each TempObj1 In CreateObject("Scripting.FileSystemObject").Drives
			With TempObj1
				If .IsReady Then
					PTS = Int(.FreeSpace / .TotalSize * 100)
					S.I = "┇盤符:"  .DriveLetter  " 文件系統(tǒng):"  .FileSystem  "	類型:"  TempArr(.DriveType)  "	卷標(biāo):"  .VolumeName
					S.I = "┇"  "	空閑率:"  PTS  "%	"  String((100 - PTS) / 5, "■")  String(PTS / 5, "□")
				Else
					S.I = "┇盤符:"  .DriveLetter  "	磁盤未準(zhǔn)備好!"
					S.I = "┇"  "	空閑率:0%	"  "≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡"
				End If
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┉"
		Disk = S
	End Function
	
	Function Sound()
		On Error Resume Next
		S.I = "☆[聲卡]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_SoundDevice")
			With TempObj
				S.I = "┣名稱/標(biāo)簽:"  .Name  "/"  .Caption
				S.I = "┇I(xiàn)D    :"  .DeviceID
				S.I = "┇制造商  :"  .Manufacturer
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		Sound = S
	End Function
	
	Function NetWork()
		On Error Resume Next
		S.I = "☆[網(wǎng)卡]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.ExecQuery("Select * from Win32_NetworkAdapter Where PhysicalAdapter = 'True'")
			With TempObj
				S.I = "┣[網(wǎng)卡:"  Space(3 - Len(.Index))  .Index  "]━━━━━━━━┉"
				S.I = "┇標(biāo)簽 :"  .Caption
				S.I = "┇PNPDID:"  .PNPDeviceID
				S.I = "┇制造商:"  .Manufacturer
				S.I = "┇速率 :"  IIf(TypeName(.Speed) = "Null", False, .Speed / 10000  "bps")
				S.I = "┇啟用 :"  .NetEnabled
				S.I = "┇服務(wù)名:"  .ServiceName
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		NetWork = S
	End Function
	
	Function Battery()
		On Error Resume Next
		TempArr1 = Split(" 放電 交流電 充滿 低 臨界 充電 充電>高 充電>低 充電>臨界 未定義 部分充電")
		TempArr2 = Split(" 其他 未知 鉛酸 鎘鎳 鎳金屬氫化物 鋰離子 鋅空氣 鋰聚合物")
		S.I = "☆[內(nèi)部電池]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_Battery")
			With TempObj
				S.I = "┣名稱/標(biāo)簽:"  .Name  "/"  .Caption
				S.I = "┇I(xiàn)D    :"  .DeviceID
				S.I = "┇PNPDID  :"  .PNPDeviceID
				S.I = "┇充電時間 :"  .BatteryRechargeTime
				S.I = "┇狀態(tài)   :"  TempArr1(.BatteryStatus)
				S.I = "┇材料   :"  TempArr2(.Chemistry)
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		Battery = S
	End Function
	
	Function PortableBattery()
		On Error Resume Next
		TempArr1 = Split(" 其他 未知 充滿 低 臨界 充電 充電>高 充電>低 充電>臨界 未定義 部分充電")
		TempArr2 = Split(" 其他 未知 鉛酸 鎘鎳 鎳金屬氫化物 鋰離子 鋅空氣 鋰聚合物")
		S.I = "☆[便攜電池]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_PortableBattery")
			With TempObj
				S.I = "┣名稱/標(biāo)簽:"  .Name  "/"  .Caption
				S.I = "┇I(xiàn)D    :"  .DeviceID
				S.I = "┇PNPDID  :"  .PNPDeviceID
				S.I = "┇制造商  :"  .Manufacturer
				S.I = "┇預(yù)計剩余 :"  .EstimatedChargeRemaining
				S.I = "┇預(yù)計時間 :"  .EstimatedRunTime
				S.I = "┇電源管理 :"  .PowerManagementSupported
				S.I = "┇位置   :"  .Location
				S.I = "┇智能電池 :"  .SmartBatteryVersion
				S.I = "┇材料   :"  TempArr2(.Chemistry)
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		PortableBattery = S
	End Function
	
	Function USB()
		On Error Resume Next
		S.I = "☆[USB塢]"
		S.I = "┏━━━━━━━━━━━━━┉"
		For Each TempObj In WMI.InstancesOf("Win32_USBController")
			With TempObj
				S.I = "┣標(biāo)簽 :"  .Caption
				S.I = "┇I(xiàn)D  :"  .DeviceID
				S.I = "┇PNPDID:"  .PNPDeviceID
				S.I = "┇制造商:"  .Manufacturer
			End With
		Next
		S.I = "┗━━━━━━━━━━━━━┉"
		USB = S
	End Function
End Class


'----

	'輸出
	Sub Print(ByVal Texts)
		WScript.StdOut.Write Texts
	End Sub
	Sub Echo(ByVal GEOM_TempData)
		WScript.Echo GEOM_TempData
	End Sub

	'輸出:覆蓋行,空白長度
	Sub PrintC(ByVal Texts, ByVal LenNum)
		WScript.StdOut.Write Chr(13)  Texts  String(LenNum, " ")
	End Sub
	
	'輸出,+換行
	Sub PrintL(ByVal Texts)
		WScript.StdOut.WriteLine(Texts)
	End Sub
	
	'輸入
	Function InPut()
		InPut = WScript.StdIn.ReadLine
	End Function

Function IIf(ByVal GEOM_tf, ByVal GEOM_T, ByVal GEOM_F)
	If GEOM_tf = True Then IIF = GEOM_T Else IIF = GEOM_F
End Function

'iif真
Function TIf(ByVal GEOM_tf, ByVal GEOM_T)
	If GEOM_tf = True Then TIF = GEOM_T
End Function

'iif假
Function FIf(ByVal GEOM_tf, ByVal GEOM_F)
	If GEOM_tf = False Then FIF = GEOM_F
End Function

運(yùn)行效果:

您可能感興趣的文章:
  • 自動化下載并檢測ftp文件備份的shell腳本
  • 用來檢測輸入的選項$1是否在PATH中的shell腳本
  • shell腳本實現(xiàn)實時檢測文件變更
  • Shell腳本實現(xiàn)檢測Cygwin最快的鏡像站點(diǎn)
  • Linux Shell腳本實現(xiàn)檢測tomcat
  • Shell腳本實現(xiàn)檢測進(jìn)程是否正在運(yùn)行
  • PowerShell腳本實現(xiàn)檢測網(wǎng)絡(luò)內(nèi)主機(jī)類型
  • 腳本批量檢測網(wǎng)站是否存活

標(biāo)簽:???/a> 邢臺 鶴壁 湖州 文山 四平 銅川 西安

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《VBS腳本寫的Windows硬件檢測工具分享》,本文關(guān)鍵詞  VBS,腳本,寫的,Windows,硬件,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《VBS腳本寫的Windows硬件檢測工具分享》相關(guān)的同類信息!
  • 本頁收集關(guān)于VBS腳本寫的Windows硬件檢測工具分享的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章