在公司做硬件维护,由于经常要面对集团的稽查。软件、硬件资料一应俱全,规范是规范,但是在金字塔的最底层就是累啊,于是就自己根据网上的脚本依葫芦画瓢,整出一个。
@echo off color 0a title Check Hardware mode con cols=90 sc config winmgmt start= auto >nul 2<&1 net start winmgmt 2>nul setlocal ENABLEDELAYEDEXPANSION del /f "%TEMP%\temp.txt" 2>nul dxdiag /t %TEMP%\temp.txt :system rem This must 30s if EXIST "%TEMP%\temp.txt" ( for /f "tokens=1,2,* delims=:" %%a in (‘findstr /c:" Machine name:" /c:" Processor:" /c:" System Model:" /c:" Memory:" /c:" Card name:" /c:"Display Memory:" /c:"Current Mode:" "%TEMP%\temp.txt"‘) do ( set /a tee+=1 if !tee! == 1 echo ComputerName: %%b if !tee! == 2 echo System Model: %%b if !tee! == 3 echo CPU Model: %%b if !tee! == 4 echo RAM Size: %%b if !tee! == 5 echo Display Card: %%b ) ) else ( ping /n 2 127.1>nul goto system ) set tee=0 echo. echo Mother Board: for /f "tokens=1,* delims==" %%a in (‘wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber /value‘) do ( set /a tee+=1 if "!tee!" == "3" echo Manufacturer = %%b if "!tee!" == "4" echo MotherBoard Model = %%b ) set tee=0 ) set tee=0 echo. echo Hard Disk: for /f "tokens=1,* delims==" %%a in (‘wmic DISKDRIVE get model^,interfacetype^,size^,totalsectors^,partitions /value‘) do ( set /a tee+=1 if "!tee!" == "3" echo Interface Class = %%b if "!tee!" == "4" echo Harddisk Model = %%b if "!tee!" == "5" echo PartionNum = %%b if "!tee!" == "6" echo Size = %%b ) echo Partion Information: wmic LOGICALDISK where mediatype=‘12‘ get description,deviceid,filesystem,size,freespace set tee=0 echo. echo NetCard: for /f "tokens=2* delims==:" %%a in (‘ipconfig/all^|find /i "Description"‘) do ( set name=%%a echo NetCard Model: %%a ) for /f "tokens=2* delims==:" %%a in (‘ipconfig/all^|find /i "Physical Address"‘) do ( set name=%%a echo MAC Address: %%a ) ver|find /i "windows xp">nul 2>nul&&goto xp||goto win7 :xp for /f "tokens=2* delims==:" %%a in (‘ipconfig/all^|find /i "IP Address"‘) do ( set name=%%a echo IP Address: %%a ) :win7 for /f "tokens=2* delims==:" %%a in (‘ipconfig/all^|find /i "IPV4"‘) do ( set name=%%a echo IP Address: %%a ) pause
效果如下
时间: 2024-11-02 03:08:41