检测硬件(转)
检测硬件.bat
1 @echo off 2 color 0a 3 title 硬件检测 4 mode con cols=90 5 sc config winmgmt start= auto >nul 2<&1 6 net start winmgmt 2>1nul 7 setlocal ENABLEDELAYEDEXPANSION 8 echo 主版: 9 for /f "tokens=1,* delims==" %%a in ('wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber /value') do ( 10 set /a tee+=1 11 if "!tee!" == "3" echo 制造商 = %%b 12 if "!tee!" == "4" echo 型 号 = %%b 13 if "!tee!" == "5" echo 序列号 = %%b 14 if "!tee!" == "6" echo 版 本 = %%b 15 ) 16 set tee=0 17 echo BIOS: 18 for /f "tokens=1,* delims==" %%a in ('wmic bios get 19 20 CurrentLanguage^,Manufacturer^,SMBIOSBIOSVersion^,SMBIOSMajorVersion^,SMBIOSMinorVersion^,ReleaseDate /value') do ( 21 set /a tee+=1 22 if "!tee!" == "3" echo 当前语言 = %%b 23 if "!tee!" == "4" echo 制造商 = %%b 24 if "!tee!" == "5" echo 发行日期 = %%b 25 if "!tee!" == "6" echo 版 本 = %%b 26 if "!tee!" == "7" echo SMBIOSMajorVersion = %%b 27 if "!tee!" == "8" echo SMBIOSMinorVersion = %%b 28 ) 29 set tee=0 30 echo. 31 echo CPU: 32 for /f "tokens=1,* delims==" %%a in ('wmic cpu get name^,ExtClock^,CpuStatus^,Description /value') do ( 33 set /a tee+=1 34 if "!tee!" == "3" echo CPU个数 = %%b 35 if "!tee!" == "4" echo 处理器版本 = %%b 36 if "!tee!" == "5" echo 外 频 = %%b 37 if "!tee!" == "6" echo 名称及主频率 = %%b 38 ) 39 set tee=0 40 echo. 41 echo 显示器: 42 for /f "tokens=1,* delims==" %%a in ('wmic DESKTOPMONITOR get name^,ScreenWidth^,ScreenHeight^,PNPDeviceID /value') do ( 43 set /a tee+=1 44 if "!tee!" == "3" echo 类 型 = %%b 45 if "!tee!" == "4" echo 其他信息 = %%b 46 if "!tee!" == "5" echo 屏幕高 = %%b 47 if "!tee!" == "6" echo 屏幕宽 = %%b 48 ) 49 set tee=0 50 echo. 51 echo 硬 盘: 52 for /f "tokens=1,* delims==" %%a in ('wmic DISKDRIVE get model^,interfacetype^,size^,totalsectors^,partitions /value') do ( 53 set /a tee+=1 54 if "!tee!" == "3" echo 接口类型 = %%b 55 if "!tee!" == "4" echo 硬盘型号 = %%b 56 if "!tee!" == "5" echo 分区数 = %%b 57 if "!tee!" == "6" echo 容 量 = %%b 58 if "!tee!" == "7" echo 总扇区 = %%b 59 ) 60 echo 分区信息: 61 wmic LOGICALDISK where mediatype='12' get description,deviceid,filesystem,size,freespace 62 set tee=0 63 echo. 64 echo 网 卡: 65 for /f "tokens=1,* delims==" %%a in ('wmic NICCONFIG where "index='1'" get ipaddress^,macaddress^,description /value') do ( 66 set /a tee+=1 67 if "!tee!" == "3" echo 网卡类型 = %%b 68 if "!tee!" == "4" echo 网卡IP = %%b 69 if "!tee!" == "5" echo 网卡MAC = %%b 70 ) 71 set tee=0 72 echo. 73 echo 打印机: 74 for /f "tokens=1,* delims==" %%a in ('wmic PRINTER get caption /value') do ( 75 set /a tee+=1 76 if "!tee!" == "3" echo 打印机名字 = %%b 77 ) 78 set tee=0 79 echo. 80 echo 声 卡: 81 for /f "tokens=1,* delims==" %%a in ('wmic SOUNDDEV get name^,deviceid /value') do ( 82 set /a tee+=1 83 if "!tee!" == "3" echo 其他信息 = %%b 84 if "!tee!" == "4" echo 型 号 = %%b 85 ) 86 set tee=0 87 echo. 88 echo 内 存: 89 for /f "tokens=1,* delims==" %%a in ('systeminfo^|find "内存"') do ( 90 echo %%a 4534 %%b 91 ) 92 echo. 93 echo 显 卡: 94 del /f "%TEMP%\temp.txt" 2>nul 95 dxdiag /t %TEMP%\temp.txt 96 :显卡 97 rem 这里需要30秒左右! 98 if EXIST "%TEMP%\temp.txt" ( 99 for /f "tokens=1,2,* delims=:" %%a in ('findstr /c:" Card name:" /c:"Display Memory:" /c:"Current Mode:" "%TEMP%\temp.txt"') do ( 100 set /a tee+=1 101 if !tee! == 1 echo 显卡型号: %%b 102 if !tee! == 2 echo 显存大小: %%b 103 if !tee! == 3 echo 当前设置: %%b 104 ) ) else ( 105 ping /n 2 127.1>nul 106 goto 显卡 107 ) 108 set /p var=需要额外信息吗(y/n): 109 if /i %var% == y notepad "%TEMP%\temp.txt" 110 del /f "%TEMP%\temp.txt" 2>nul 111 pause