本帖最后由 qixiaobin0715 于 2022-7-29 09:32 编辑
如果非要按照17楼的格式显示的话,可将16楼代码进行修改,效率要高不少,代码另存为ANSI编码:- @echo off & setlocal enabledelayedexpansion
- set DiskNumber=0
- set AudioNumber=0
- set MemoryNumber=0
- set Order=findstr /i /l /c:"[overviewinfowrapper] CPUName :" /c:"[processmemory] SpdOverview." /c:"[gpuprocesser] VideoAdapter" /c:"[motherboardinfowrapper] GetMotherboardInfo:" /c:"[monitorinfowrapper] find primary monitor" /c:"[disk_client] ModelNumber" /c:"[networkinfo] GetNetworkInfo: NetworkParams.strDescription" /c:"[audioinfo] Multimedia(Hi-definition Audio):" "ComputerZ_HardwareDll.log"
- for /f "tokens=9-12 delims=]:=" %%a in ('%Order%') do (
- set str=%%a
- set str=!str:~1,4!
- if "!str!"=="CPUN" (
- set CPUName=%%b
- ) else if "!str!"=="GetM" (
- set MotherboardInfo=%%b
- ) else if "!str!"=="GetN" (
- for /f "tokens=2 delims=[" %%i in ("%%b") do (
- if not defined _%%i (
- set /a NetworkNumber+=1
- set Network%%i=%%d
- set _%%i=true
- )
- )
- ) else if "!str!"=="Mode" (
- set Disk!DiskNumber!Number=%%c
- set /a DiskNumber+=1
- ) else if "!str!"=="Mult" (
- for /f "tokens=2 delims=@" %%i in ("%%b") do set Audio!AudioNumber!Number=%%i
- set /a AudioNumber+=1
- ) else if "!str!"=="SpdO" (
- for /f "tokens=2 delims=. " %%i in ("%%a") do set Memory!MemoryNumber!Name=%%d
- set /a MemoryNumber+=1
- ) else if "!str!"=="Vide" (
- set VideoAdapter=%%b
- ) else if "!str!"=="find" (
- set monitor=%%b
- )
- )
- echo [硬件参数]
- set CPUName
- set MemoryNumber
- set MemoryNumber=
- set Memory
- set VideoAdapter
- set MotherboardInfo
- set monitor
- set DiskNumber
- set DiskNumber=
- set Disk
- set NetworkNumber
- set NetworkNumber=
- set Network
- set AudioNumber
- set AudioNumber=
- set Audio
- pause
复制代码
|