您好,登錄后才能下訂單哦!
小編給大家分享一下計算機中怎么批處理獲取硬件信息的代碼,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
1.運行環境判斷,若自身被修改則自動閃退;若PE環境則提示并指引退出;若虛擬機環境則提示信息獲取可能不準;若非管理員權限也會截取并提示。
2.關于硬盤、內存容量的計算方面支持 字節 KB MB GB TB PB
3.由于有些電腦多網卡、顯卡、聲卡,此程序只獲取正在使用的相關信息
4.硬盤溫度,使用時間,通電次數純批處理實現!(原創代碼,轉載請注明出處!)
5.純批處理實現系統密匙獲取(通過注冊表中的加密數據進行解密)
以下是最新版本,不用后翻。
更新內容:
1.解決了眾多網友反應的關于網卡信息獲取不準的問題,目前已基本完美
2.調整了代碼結構,優化了效率和邏輯順序(基本上等于重寫了一遍)
3.解決了之前多種情況遇到的閃退,現在只要不改代碼基本是不會閃退的
最后聲明:電腦系統情況多樣且復雜并非完美版本 ,希望大家多多測試并提供BUG截圖 以后會根據大家的測試結果不斷更新。
本人QQ:540044977 若要獲取實時最新版可以加好友索要,歡迎志同道合的朋友前來交流。
以下是代碼:
@echo off mode con cols=82 lines=25 Setlocal EnableDelayedExpansion call :Inspect title 獲取硬件信息 - 正在獲取相關信息,請稍等... echo !Tit! echo ............................................................. echo. DxDiag /t %Temp%\Dxdiag.dll Ping www.baidu.com>nul if %errorlevel%==0 set NetWorking=已聯網 if %errorlevel%==1 set NetWorking=未聯網 :DxDiag if exist "%Temp%\Dxdiag.dll" ( for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"Operating System: " %Temp%\Dxdiag.dll') do ( for /f "delims=(" %%j in ("%%i") do set OS=%%j ) ) else ( Goto :DxDiag ) title 獲取硬件信息 - %OS% for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"Processor: " %Temp%\Dxdiag.dll') do set CPU=%%i for /l %%i in (256 -1 0) do if "!CPU:~%%i,1!"=="" set CPU.Len=%%i if %CPU.Len% gtr 67 set CPU= %CPU:~0,60% ... echo.CPU .......%CPU% echo. for /f "skip=2 tokens=2 delims==" %%i in ('Wmic BaseBoard get Manufacturer^,Product^,SerialNumber^,Version /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set Manufacturer=%%i if !Row! == 2 set Product=%%i if !Row! == 3 set SerialNumber=%%i if !Row! == 4 set Version=%%i ) set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic bios get InstallableLanguages^,ReleaseDate^,SMBIOSBIOSVersion /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set InstallableLanguages=%%i if !Row! == 2 set ReleaseDate=%%i if !Row! == 3 set SMBIOSBIOSVersion=%%i ) set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Memphysical Get MaxCapacity^,MemoryDevices /Value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set MaxCapacity=%%i if !Row! == 2 set MemoryDevices=%%i ) for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Csproduct get Uuid /Value 2^>nul') do set Uuid=%%i if "%Version%"==" " set Version=無 if "%SerialNumber%"==" " set SerialNumber=無 set /a MaxCapacity=!MaxCapacity!/1048576 set MaxCapacity=!MaxCapacity! GB set MemoryDevices=!MemoryDevices! 個 set InstallableLanguages=!InstallableLanguages! 國語言 set ReleaseDate=%ReleaseDate:~0,4% 年 %ReleaseDate:~4,2% 月 %ReleaseDate:~6,2% 日 if "%Uuid%" == "00000000-0000-0000-0000-000000000000" set Uuid=主板維修過 if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星 if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=華碩 if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米 if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷 if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂達 if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正 if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升 if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特爾 if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=銘瑄 if /i "%Manufacturer:~0,6%" == "LENOVO" set Manufacturer=聯想 if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=華擎 if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影馳 if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=東芝 if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰 if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉 if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹 if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=藍寶石 if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=機械格命 if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微 echo.主板 ....... %Manufacturer% %Product% echo. for /f "tokens=2 delims==" %%i in ('Wmic Path Win32_PhysicalMemory Get BankLabel /value 2^>nul') do set /a MemoryQuantity+=1 set MemorySize=0 for /f "tokens=3 delims=:" %%i in ('Find /c /v "" %0') do set /a H.Size=%%i for /f "tokens=2 delims==" %%i in ('Wmic Path Win32_PhysicalMemory Get Capacity /value 2^>nul') do ( set Capacity=%%i call :Addition !Capacity! !MemorySize! MemorySize ) call :GetSize !MemorySize! MemorySize if not !H.Size!==1069 Goto :Eof if "!MemorySize:~-5,3!"==".00" set MemorySize=!MemorySize:~0,-5! !MemorySize:~-2! if "!MemorySize!"=="EB" Goto :Eof echo.內存 ....... %MemoryQuantity% 條 %MemorySize% echo. for /f "tokens=2 delims==" %%i in ('Wmic DiskDrive Get Model /Value^|Find /i /v "USB"') do ( set /a HdQuantity+=1 if !HdQuantity! == 1 set FirstDisk=%%i ) echo.硬盤 ....... %HdQuantity% 塊 %FirstDisk% (主) echo. set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Path Win32_VideoController Get Name^,AdapterRam^,DriverDate^,DriverVersion^,VideoProcessor^,MaxRefreshRate^,MinRefreshRate^,VideoProcessor^,CurrentBitsPerPixel^,CurrentRefreshRate^,CurrentHorizontalResolution^,CurrentVerticalResolution /Value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set AdapterRAM=%%i if !Row! == 2 set CurrentBitsPerPixel=%%i if !Row! == 3 set CurrentHorizontalResolution=%%i if !Row! == 4 set CurrentRefreshRate=%%i if !Row! == 5 set CurrentVerticalResolution=%%i if !Row! == 6 set DriverDate=%%i if !Row! == 7 set DriverVersion=%%i if !Row! == 8 set MaxRefreshRate=%%i if !Row! == 9 set MinRefreshRate=%%i if !Row! == 10 set VideoName=%%i if !Row! == 11 set VideoProcessor=%%i ) if "%CurrentBitsPerPixel%" == "" ( set Row=0 for /f "skip=15 tokens=2 delims==" %%i in ('Wmic Path Win32_VideoController Get Name^,AdapterRam^,DriverDate^,DriverVersion^,VideoProcessor^,MaxRefreshRate^,MinRefreshRate^,VideoProcessor^,CurrentBitsPerPixel^,CurrentRefreshRate^,CurrentHorizontalResolution^,CurrentVerticalResolution /Value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set AdapterRAM=%%i if !Row! == 2 set CurrentBitsPerPixel=%%i if !Row! == 3 set CurrentHorizontalResolution=%%i if !Row! == 4 set CurrentRefreshRate=%%i if !Row! == 5 set CurrentVerticalResolution=%%i if !Row! == 6 set DriverDate=%%i if !Row! == 7 set DriverVersion=%%i if !Row! == 8 set MaxRefreshRate=%%i if !Row! == 9 set MinRefreshRate=%%i if !Row! == 10 set VideoName=%%i if !Row! == 11 set VideoProcessor=%%i ) ) if "!AdapterRAM:~0,1!" == "-" set AdapterRAM=%AdapterRAM:~1% call :GetSize !AdapterRAM! AdapterRAM if "!AdapterRam:~-5,3!"==".00" set AdapterRam=!AdapterRam:~0,-5! !AdapterRam:~-2! set DriverDate=%DriverDate:~0,4% 年 %DriverDate:~4,2% 月 %DriverDate:~6,2% 日 set "Resolution=%CurrentHorizontalResolution% x %CurrentVerticalResolution% (%CurrentBitsPerPixel% bit) (%CurrentRefreshRate% Hz)" echo.顯卡 ....... %VideoName% %AdapterRAM% echo. set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic DesktopMonitor Get PNPDeviceID^,PixelsPerXLogicalInch /Value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set PixelsPerXLogicalInch=%%i if !Row! == 2 set PNPDeviceID=%%i ) for /f "delims=\ tokens=2" %%i in ("!PNPDeviceID!") do set DisplayName=%%i if "%DisplayName%"=="" (echo.屏幕 ....... !Resolution!) else (echo.屏幕 ....... !DisplayName! !Resolution!) echo. set Row=0 for /f "tokens=2 delims==" %%i in ('Wmic Path Win32_CDRomDrive Get Name^,MediaLoaded /Value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set MediaLoaded=%%i if !Row! == 2 set CD-ROM.Name=%%i ) if "%CD-ROM.Name%"=="" (set CD-ROM.Name=無) else (if /i "%MediaLoaded%"=="TRUE" set "MediaLoaded=(有盤)" if /i "%MediaLoaded%"=="FALSE" set "MediaLoaded=(空)") echo.光驅 ....... %CD-ROM.Name% %MediaLoaded% echo. set Row=0 for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"Description: " %Temp%\Dxdiag.dll') do ( set /a Row+=1 if !Row! == 1 set Description=%%i ) echo 聲卡 .......%Description% (輸出) echo. set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Path Win32_NetworkAdapterConfiguration WHERE "IPEnabled='TRUE'" get IPAddress^,IPSubnet^,MACAddress^,DefaultIPGateway^,Caption /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set NetName=%%i if !Row! == 2 set DefaultIPGateway=%%i if !Row! == 3 set IP=%%i if !Row! == 4 set IPSubnet=%%i if !Row! == 5 set MACAddress=%%i ) if "%DefaultIPGateway%" == "" ( set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Path Win32_NetworkAdapterConfiguration WHERE "DHCPEnabled='TRUE'" get IPAddress^,IPSubnet^,MACAddress^,DefaultIPGateway^,Caption /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set NetName=%%i if !Row! == 2 set DefaultIPGateway=%%i if !Row! == 3 set IP=%%i if !Row! == 4 set IPSubnet=%%i if !Row! == 5 set MACAddress=%%i ) ) if "%DefaultIPGateway%" == "" ( set Row=0 for /f "skip=9 tokens=2 delims==" %%i in ('Wmic Path Win32_NetworkAdapterConfiguration WHERE "DHCPEnabled='TRUE'" get IPAddress^,IPSubnet^,MACAddress^,DefaultIPGateway^,Caption /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set NetName=%%i if !Row! == 2 set DefaultIPGateway=%%i if !Row! == 3 set IP=%%i if !Row! == 4 set IPSubnet=%%i if !Row! == 5 set MACAddress=%%i ) ) if "%DefaultIPGateway%" == "" ( set Row=0 for /f "skip=16 tokens=2 delims==" %%i in ('Wmic Path Win32_NetworkAdapterConfiguration WHERE "DHCPEnabled='TRUE'" get IPAddress^,IPSubnet^,MACAddress^,DefaultIPGateway^,Caption /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set NetName=%%i if !Row! == 2 set DefaultIPGateway=%%i if !Row! == 3 set IP=%%i if !Row! == 4 set IPSubnet=%%i if !Row! == 5 set MACAddress=%%i ) ) if "%DefaultIPGateway%" == "" ( set IP=未聯網 set IPSubnet=未聯網 set DefaultIPGateway=未聯網 ) if "%MACAddress%" == "" set MACAddress=網卡已被禁用 for /f "tokens=2 delims=]" %%i in ("!NetName!") do set NetName=%%i if "!NetName:~0,1!" == " " set NetName=!NetName:~1! for /f "delims=," %%i in ("!IP!") do set IP=%%i for /f "delims=," %%i in ("!IPSubnet!") do set IPSubnet=%%i set IP=!IP:"=! set IP=!IP:{=! set IP=!IP:}=! set IPSubnet=!IPSubnet:"=! set IPSubnet=!IPSubnet:{=! set IPSubnet=!IPSubnet:}=! set DefaultIPGateway=!DefaultIPGateway:{"=! set DefaultIPGateway=!DefaultIPGateway:"}=! echo 網卡 ....... %NetName% (%NetWorking%) echo. echo. set /p 540044977=若要生成詳細的電腦配置信息文件請直接回車: Title 獲取硬件信息 - 正在生成詳細信息,請稍等... if "!Titl!" Neq "檢測環境處于虛擬機中,以下信息可能不準:" Color 08 set Tim.1=%Time% set File=%ComputerName%.Txt Reg add "HKCU\Software\Microsoft\Notepad" /v "lfFaceName" /d "fixedsys" /f >nul 2>nul echo %Titl%>!File! echo ...................................................................... >>!File! echo.>>!File! echo.關于電腦綜述信息如下:>>!File! for /f "tokens=3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "DigitalProductId" 2^>nul') do set DigitalProductId=%%i if "!DigitalProductId!"=="" ( set Key=未獲取 goto :Skip) set Row=-1 for /l %%i in (0,2,327) do ( set /a Row+=1 set F=!DigitalProductId:~%%i,2! set /a Id!Row!=0X!F:~0,1!*16+0X!F:~1,1! ) set /a Win10=!Id66!/6^&1 set /a Id66=(!Id66!^&0XF7)^|((!Win10!^&2)*4) set Maps=BCDFGHJKMPQRTVWXY2346789 for /l %%i in (24 -1 0) do ( set Current=0 for /l %%j in (14 -1 0) do ( set /a Current*=256 set /a J=%%j+52 set /a Current=Id!J!+!Current! set /a Id!J!=!Current!/24 set /a Current=!Current!%%24 ) for /l %%k in (0,1,24) do ( if !Current!==%%k ( set KeyTemp=!Maps:~%%k,1!!KeyTemp! ) ) set Last=!Current! ) if !Win10!==1 ( for /l %%i in (0,1,24) do set keypart1=!KeyTemp:~1,%%i! set Insert=N for /l %%i in (1,1,24) do ( Set L=!L!!KeyTemp:~%%i,1! if %%i==!Last! Set L=!L!!Insert! ) Set KeyTemp=!L! if !Last!==0 Set KeyTemp=!Insert!!KeyTemp! ) Set Key=!KeyTemp:~0,5!-!KeyTemp:~5,5!-!KeyTemp:~10,5!-!KeyTemp:~15,5!-!KeyTemp:~20,5! :Skip for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"System Manufacturer:" %Temp%\Dxdiag.dll') do set PCbrand=%%i if /i "%PCbrand:~1,2%" == "HP" set PCbrand=惠普 if /i "%PCbrand:~1,3%" == "MSI" set PCbrand=微星 if /i "%PCbrand:~1,4%" == "ACER" set PCbrand=宏碁 if /i "%PCbrand:~1,4%" == "TIMI" set PCbrand=小米 if /i "%PCbrand:~1,4%" == "DELL" set PCbrand=戴爾 if /i "%PCbrand:~1,4%" == "ASUS" set PCbrand=華碩 if /i "%PCbrand:~1,5%" == "HASEE" set PCbrand=神州 if /i "%PCbrand:~1,5%" == "HAIER" set PCbrand=海爾 if /i "%PCbrand:~1,6%" == "LENOVO" set PCbrand=聯想 if /i "%PCbrand:~1,7%" == "SAMSUNG" set PCbrand=三星 if /i "%PCbrand:~1,7%" == "TOSHIBA" set PCbrand=東芝 if /i "%PCbrand:~1,8%" == "GIGABYTE" set PCbrand=技嘉 if /i "%PCbrand:~1,8%" == "MECHREVO" set PCbrand=機械格命 for /f "tokens=2 delims=:" %%j in ('Findstr /IC:"System Model:" %Temp%\Dxdiag.dll') do ( set PCModel=%%j set PCModel=!PCModel:~1! ) for /f "tokens=2 delims=={}" %%i in ('Wmic PATH Win32_SystemEnclosure get ChassisTypes /value 2^>nul') do ( for %%j in (3,4,6,7,15) do if %%j == %%i set PCtype=臺式機 for %%j in (8,9,10,14) do if %%j == %%i set PCtype=筆記本 if %%i == 13 set PCtype=一體機 ) if "!PCtype!" == "" set PCtype=未知 if "!PCtype!" == "臺式機" set PCbrand=%Manufacturer% if "!PCtype!" == "臺式機" set PCModel=%Product% if "!Titl!" == "檢測環境處于虛擬機中,以下信息可能不準:" set PCbrand=虛擬機&set PCModel=虛擬機 echo.>>!File! echo. 名稱 ................... : %ComputerName%>>!File! echo.>>!File! echo. 品牌 ................... : %PCbrand%>>!File! echo.>>!File! echo. 型號 ................... : %PCModel%>>!File! echo.>>!File! echo. 類型 ................... : %PCtype%>>!File! echo.>>!File! for /f "tokens=2 delims==" %%i in ('Wmic OS Get InstallDate /Value 2^>nul') do set InstallDate=%%i set InstallDate=!InstallDate:~0,4! 年 !InstallDate:~4,2! 月 !InstallDate:~6,2! 日 !InstallDate:~8,2! 時 !InstallDate:~10,2! 分 !InstallDate:~12,2! 秒 echo. 當前用戶 ............... : !UserName!>>!File! echo.>>!File! echo. 系統版本 ............... :!OS!>>!File! echo.>>!File! for /f "tokens=2 delims==" %%i in ('wmic os get Version /value') do set OSVersion=%%i echo. 系統版本號 ............. : !OSVersion!>>!File! echo.>>!File! for /f "tokens=2 delims==" %%i in ('wmic os get SerialNumber /value') do set SerialNumber=%%i echo. 系統序列號 ............. : !SerialNumber!>>!File! echo.>>!File! echo. 系統密匙 ............... : !Key!>>!File! echo.>>!File! for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"DirectX Version: " %Temp%\Dxdiag.dll') do set DirectX=%%i echo. DirectX 版本 ........... :%DirectX%>>!File! echo.>>!File! for /f "tokens=2 delims==" %%i in ('Wmic OS Get LastBootUpTime /Value 2^>nul') do ( set L=%%i set LastBootUpTime=!L:~0,4! 年 !L:~4,2! 月 !L:~6,2! 日 !L:~8,2! 時 !L:~10,2! 分 !L:~12,2! 秒 ) echo. 開機時間 ............... : %LastBootUpTime%>>!File! echo.>>!File! echo. 系統初始安裝日期 ....... : %InstallDate%>>!File! echo.>>!File! echo.>>!File! echo.關于 CPU 的詳細信息如下:>>!File! echo.>>!File! echo. 名稱 ........... :%CPU%>>!File! echo.>>!File! set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic CPU get Name^,AddressWidth^,CurrentVoltage^,ExtClock^,Family^,MaxClockSpeed^,ProcessorId^,Revision^,SocketDesignation^,Stepping /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set AddressWidth=%%i if !Row! == 2 set CurrentVoltage=%%i if !Row! == 3 set ExtClock=%%i if !Row! == 4 set Family=%%i if !Row! == 5 set MaxClockSpeed=%%i if !Row! == 6 set CpuName=%%i if !Row! == 7 set ProcessorId=%%i if !Row! == 8 set Revision=%%i if !Row! == 9 set SocketDesignation=%%i if !Row! == 10 set Stepping=%%i ) set CurrentVoltage=%CurrentVoltage:~0,1%.%CurrentVoltage:~1% set NumberOfProcessors=-1 for /f "tokens=2 delims==" %%i in ('Wmic path Win32_PerfFormattedData_PerfOS_Processor get PercentIdleTime /value 2^>nul') do ( set /a NumberOfProcessors+=1 set CpuOccupy=%%i ) if "%NumberOfProcessors%"=="-1" for /f "delims== tokens=2" %%i in ('Wmic cpu Get NumberOfLogicalProcessors /Value 2^>nul') do set NumberOfProcessors=%%i if "%NumberOfProcessors%"=="-1" set NumberOfProcessors=未獲取 set Row=0 for /f "Skip=1" %%i in ('Wmic Path Win32_CacheMemory Get MaxCacheSize 2^>nul') do ( set /a Row+=1 if !Row! == 1 set One=%%i if !Row! == 2 set Two=%%i if !Row! == 3 set Three=%%i ) set /a CpuOccupy=100-%CpuOccupy% if "%CpuOccupy%" == "" set CpuOccupy=. if "%CpuOccupy%" == " " set CpuOccupy=. if "%One%" == "" set One=0 if "%Two%" == "" set Two=0 if "%Three%"=="" set Three=0 if "%One%" == " " set One=0 if "%Two%" == " " set Two=0 if "%Three%"==" " set Three=0 if "%Family%" == "" set Family=. if "%Family%" == " " set Family=. if "%Revision%" == "" set Revision=. if "%Revision%" == " " set Revision=. if "%Stepping%" == "" set Stepping=. if "%Stepping%" == " " set Stepping=. if "%AddressWidth%" == "" set AddressWidth=. if "%AddressWidth%" == " " set AddressWidth=. if "%CurrentVoltage%" == "" set CurrentVoltage=. if "%CurrentVoltage%" == " " set CurrentVoltage=. call :Space !CpuOccupy! 12 Blank.1 call :Space !CurrentVoltage! 11 Blank.2 call :Space !Stepping! 8 Blank.3 call :Space !AddressWidth! 12 Blank.4 call :Space !Family! 8 Blank.5 echo. 核心 ........... : %NumberOfProcessors% 核心>>!File! echo.>>!File! echo. 主頻 ........... : %MaxClockSpeed% Mhz>>!File! echo.>>!File! echo. 外頻 ........... : %ExtClock% Mhz>>!File! echo.>>!File! if "!NumberOfProcessors!" neq "未獲取" ( set /a Score=!NumberOfProcessors!*!MaxClockSpeed! echo. 性能評分 ....... : !Score! 分>>!File! echo.>>!File! ) echo. 一級緩存 ....... : %One% Kb>>!File! echo.>>!File! echo. 二級緩存 ....... : %Two% Kb>>!File! echo.>>!File! echo. 三級緩存 ....... : %Three% Kb>>!File! echo.>>!File! echo. 插槽 ........... : %SocketDesignation%>>!File! echo.>>!File! echo. 編號 ........... : %ProcessorId%>>!File! echo.>>!File! echo.>>!File! echo. 已用(%) 電壓(V) 步進 位寬(位) 家族 修訂版號>>!File! echo.>>!File! echo. %CpuOccupy%%Blank.1%%CurrentVoltage%%Blank.2%%Stepping%%Blank.3%%AddressWidth%%Blank.4%%Family%%Blank.5%%Revision%>>!File! echo.>>!File! echo.>>!File! echo.關于主板的詳細信息如下:>>!File! echo.>>!File! echo. 品牌 ........... : %Manufacturer%>>!File! echo.>>!File! echo. 型號 ........... : %Product%>>!File! echo.>>!File! echo. 版本 ........... : %Version%>>!File! echo.>>!File! echo. 序列號 ......... : %SerialNumber%>>!File! echo.>>!File! echo. 內存插槽 ....... : %MemoryDevices%>>!File! echo.>>!File! echo. 內存支持 ....... : %MaxCapacity%>>!File! echo.>>!File! echo. 出廠日期 ....... : %ReleaseDate%>>!File! echo.>>!File! echo. CPU 插槽 ....... : %SocketDesignation%>>!File! echo.>>!File! echo. BIOS 版本 ...... : %SmbiosbioSversion%>>!File! echo.>>!File! echo. BIOS 語言 ...... : %InstallableLanguages%>>!File! echo.>>!File! echo. 唯一標識 ....... : %Uuid%>>!File! echo.>>!File! echo.>>!File! echo.關于內存的詳細信息如下:>>!File! echo.>>!File! echo. 數量 ........... : %MemoryQuantity% 條>>!File! echo.>>!File! echo. 總容量 ......... : %MemorySize%>>!File! echo.>>!File! echo.>>!File! echo. 內存 容量 頻率 插槽>>!File! echo.>>!File! set Row=0 for /f "skip=1 delims=" %%i in ('Wmic Path Win32_PhysicalMemory Get DeviceLocator^,Capacity^,Speed') do ( set /a Row+=1 set i=%%i for /f "tokens=1,2,3" %%j in ("!i!") do ( set MemorySize=%%j set DeviceLocator=%%k set Speed=%%l ) if "!Speed!"=="" set Speed=NotGet call :GetSize !MemorySize! MS call ::Space !MS! 13 Blank.1 call ::Space !Speed! 10 Blank.2 if not "!i:~1,1!"== "" echo. !Row! !MS!!Blank.1!!Speed!!Blank.2!!DeviceLocator!>>!File! ) echo.>>!File! echo.>>!File! set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic path Win32_PerfFormattedData_PerfOS_Memory get AvailableBytes^,CommittedBytes^,CommitLimit /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set AvailableBytes=%%i if !Row! == 2 set CommitLimit=%%i if !Row! == 3 set CommittedBytes=%%i ) if "!CommitLimit!" neq "" call :GetSize !CommitLimit! CommitLimit if "!AvailableBytes!" neq "" call :GetSize !AvailableBytes! Available if "!CommittedBytes!" neq "" call :GetSize !CommittedBytes! Committed if "!Available!" neq "" ( echo. 已用內存 : %Committed% 可用內存 : %Available% 提交限制 : %CommitLimit%>>!File! echo.>>!File! echo.>>!File! ) echo.關于硬盤的詳細信息如下:>>!File! echo.>>!File! echo. 數量 ........... : %HdQuantity% 塊>>!File! echo.>>!File! set HdSize=0 for /f "skip=1 delims=" %%i in ('Wmic DiskDrive Get Size') do ( set Var.i=%%i call :Addition !Var.i! !HdSize! HdSize ) call :GetSize !HdSize! HdSize if "!HdSize:~-5,3!"==".00" set HdSize=!HdSize:~0,-5! !HdSize:~-2! echo. 實際容量 .............. : !HdSize!>>!File! echo.>>!File! if "!Tit!"=="檢測環境處于虛擬機中,以下信息可能不準:" Goto :Go for /f "tokens=2 delims==" %%i in ('Wmic /NameSpace:\\root\wmi Path MSStorageDriver_ATAPISmartData get VendorSpecific /Value 2^>Nul') do ( set /a DiskNuber+=1 set Smart=%%i set Smart=!Smart:,= ! if not !H.Size!==1069 Goto :Eof for /l %%j in (3 12 362) do ( set Nu.1=0 for %%k in (!Smart!) do ( set /a Nu.1+=1 if !Nu.1! == %%j ( if %%k == 9 (set /a Nu.2=!Nu.1!+7 call :Calc !Nu.1! !Nu.2! PowerOnTimeCount) if %%k == 12 (set /a Nu.2=!Nu.1!+7 call :Calc !Nu.1! !Nu.2! StartStopCount) set /a Nu.3=0,Nu.4=0 if %%k == 190 (set /a Nu.3=!Nu.1!+5 for %%l in (!Smart!) do ( set /a Nu.4+=1 if !Nu.4! == !Nu.3! set Temperature=%%l ) ) else ( if %%k == 194 (set /a Nu.3=!Nu.1!+5 for %%l in (!Smart!) do ( set /a Nu.4+=1 if !Nu.4! == !Nu.3! set Temperature=%%l ) ) ) ) ) ) set /a Day=!PowerOnTimeCount!/24 echo.>>!File! echo 硬盤 !DiskNuber!: >>!File! echo.>>!File! echo 當前硬盤溫度 ..................... : !Temperature! ℃>>!File! echo.>>!File! echo 截至目前硬盤已啟停 ..................... : !StartStopCount! 次>>!File! echo.>>!File! echo 截至目前硬盤已累計運行 ....................... : !PowerOnTimeCount! 小時(!Day!天)>>!File! ) echo.>>!File! :Go echo.>>!File! echo. 硬盤 分區 模式 容量 狀態 型號>>!File! echo.>>!File! set Row=0 for /f "skip=1 delims=" %%i in ('Wmic DiskDrive Get Partitions^,InterFacetype^,Size^|Find /i /v "USB"') do ( set /a Row+=1 set i=%%i for /f "tokens=1,2,3" %%j in ("!i!") do ( set InterfaceType=%%j set Partitions=%%k set DiskSize=%%l ) set Rox=0 for /f "skip=1 delims=" %%m in ('Wmic DiskDrive Get Caption^|Find /i /v "USB"') do ( set /a Rox+=1 if !Rox! == !Row! set DiskCaption=%%m ) if !Row! == 1 (set Disklevel=主盤) else (set Disklevel=從盤) call :GetSize !DiskSize! NominalSize if "!NominalSize:~0,3!" == "74." set NominalSize=80GB if "!NominalSize:~0,3!" == "111" set NominalSize=120GB if "!NominalSize:~0,3!" == "119" set NominalSize=128GB if "!NominalSize:~0,3!" == "149" set NominalSize=160GB if "!NominalSize:~0,3!" == "223" set NominalSize=240GB if "!NominalSize:~0,3!" == "232" set NominalSize=250GB if "!NominalSize:~0,3!" == "238" set NominalSize=256GB if "!NominalSize:~0,3!" == "298" set NominalSize=320GB if "!NominalSize:~0,3!" == "335" set NominalSize=360GB if "!NominalSize:~0,3!" == "447" set NominalSize=480GB if "!NominalSize:~0,3!" == "465" set NominalSize=500GB if "!NominalSize:~0,3!" == "476" set NominalSize=512GB if "!NominalSize:~0,3!" == "698" set NominalSize=750GB if "!NominalSize:~0,3!" == "931" set NominalSize=1TB if "!NominalSize:~0,3!" == "1.8" set NominalSize=2TB if "!NominalSize:~0,3!" == "2.7" set NominalSize=3TB if "!NominalSize:~0,3!" == "3.6" set NominalSize=4TB if "!NominalSize:~0,3!" == "4.5" set NominalSize=5TB if "!NominalSize:~0,3!" == "5.4" set NominalSize=6TB if "!NominalSize:~0,3!" == "7.2" set NominalSize=8TB if "!NominalSize:~0,3!" == "9.0" set NominalSize=10TB call :Space !Row! 8 Blank.1 call :Space !Partitions! 9 Blank.2 call :Space !InterfaceType! 12 Blank.3 call :Space !NominalSize! 12 Blank.4 if not "!i:~1,1!"=="" echo. !Row!!Blank.1!!Partitions!!Blank.2!!InterfaceType!!Blank.3!!NominalSize!!Blank.4!!Disklevel! !DiskCaption!>>!File! ) echo.>>!File! echo.>>!File! echo. 盤符 格式 容量 已用 剩余 卷標>>!File! echo.>>!File! for /f "skip=1 delims=" %%i in ('Wmic LogicalDisk Where Mediatype^='12' Get DeviceID^,FileSystem^,Size^,FreeSpace^,VolumeName') do ( set i=%%i for /f "tokens=1,2,3,4,*" %%j in ("!i!") do ( set DeviceID=%%j set FileSystem=%%k set FreeSpace=%%l set PartitionSize=%%m set VolumeName=%%n if "!VolumeName!"=="" set VolumeName=默認值 ) if "!FileSystem!"=="" ( set FileSystem=RAW set Total=0.00GB set Used=0.00GB set Free=0.00GB ) Else ( call :Minus !PartitionSize! !FreeSpace! PartitionUsed call :GetSize !FreeSpace! Free call :GetSize !PartitionSize! Total call :GetSize !PartitionUsed! Used if "!Free:~-5,3!"==".00" set Free=!Free:~0,-5!!Free:~-2! if "!Total:~-5,3!"==".00" set Total=!Total:~0,-5!!Total:~-2! if "!Used:~-5,3!"==".00" set Used=!Used:~0,-5!!Used:~-2! ) call :Space !FileSystem! 9 Blank.1 call :Space !Total! 12 Blank.2 call :Space !Used! 12 Blank.3 call :Space !Free! 12 Blank.4 if not "!i:~3,1!"=="" echo. !DeviceID! !FileSystem!!Blank.1!!Total!!Blank.2!!Used!!Blank.3!!Free!!Blank.4!!VolumeName!>>!File! ) echo.>>!File! echo.>>!File! echo.關于顯卡的詳細信息如下:>>!File! echo.>>!File! echo. 名稱 ........... : %VideoName%>>!File! echo.>>!File! echo. 顯存 ........... : %AdapterRAM%>>!File! echo.>>!File! echo. 當前模式 ....... : %Resolution%>>!File! echo.>>!File! echo. 驅動版本 ....... : %DriverVersion%>>!File! echo.>>!File! echo. 驅動日期 ....... : %DriverDate%>>!File! echo.>>!File! echo. 內核名稱 ....... : %VideoProcessor%>>!File! echo.>>!File! echo.>>!File! echo.關于顯示器的詳細信息如下:>>!File! echo.>>!File! if "%DisplayName%" == "" set DisplayName=未獲取 echo. 型號 ........... : %DisplayName%>>!File! echo.>>!File! echo. 像素密度 ....... : %PixelsPerXLogicalInch% Dpi>>!File! echo.>>!File! echo. 當前模式 ....... : %Resolution%>>!File! if "%CD-ROM.Name%" neq "無" ( echo.>>!File! echo.>>!File! echo.關于光驅的詳細信息如下:>>!File! echo.>>!File! echo. 列出所有光驅: >>!File! echo.>>!File! echo. 盤符 類型 型號 >>!File! echo.>>!File! for /f "skip=1 delims=" %%i in ('Wmic CdRom Get Name^,Drive^,Mediatype') do echo. %%i>>!File! ) echo.>>!File! echo.>>!File! echo.關于聲卡的詳細信息如下:>>!File! echo.>>!File! echo. 列出所有聲卡: >>!File! echo.>>!File! set Row=0 for /f "delims== tokens=2" %%i in ('Wmic Sounddev Get ProductName /Value 2^>nul') do ( set /a Row+=1 echo. !Row!. %%i>>!File! ) echo.>>!File! echo. 當前聲卡信息: >>!File! echo.>>!File! set Row=0 for /f "tokens=2 delims=:" %%i in ('Findstr /IC:"Driver Version: " %Temp%\Dxdiag.dll') do ( set /a Row+=1 if !Row! == 2 set SoundDriverVersion=%%i ) for /f "tokens=1,* delims=:" %%i in ('Findstr /IC:"Date and Size: " %Temp%\Dxdiag.dll') do ( if "%%j"==" " ( set SoundDate=未獲取 set SoundSize=未獲取 Goto :NoDateandSize) else ( for /f "tokens=1,2 delims=," %%k in ("%%j") do ( set SoundDate=%%k set SoundSize=%%l ))) for /f %%i in ("!SoundSize!") do call :GetSize %%i SoundSize for /f %%i in ("!SoundDate!") do set SoundDate=%%i for /f "tokens=1,2,3 delims=/" %%i in ("!SoundDate!") do ( if %%i lss %%k set SoundDate=%%k 年 %%i 月 %%j 日 if %%i gtr %%k set SoundDate=%%i 年 %%j 月 %%k 日 ) :NoDateandSize echo. 輸出聲卡 ....... :!Description!>>!File! echo.>>!File! echo. 驅動版本 ....... :!SoundDriverVersion!>>!File! echo.>>!File! echo. 驅動日期 ....... : !SoundDate!>>!File! echo.>>!File! echo. 驅動大小 ....... : !SoundSize!>>!File! echo.>>!File! echo.>>!File! echo.關于網卡的詳細信息如下:>>!File! echo.>>!File! echo. 網卡名稱 ....... : !NetName!>>!File! echo.>>!File! echo. 內網IP ......... : !IP!>>!File! echo.>>!File! echo. 網關 ........... : %DefaultIPGateway%>>!File! echo.>>!File! echo. 掩碼 ........... : %IPSubnet%>>!File! echo.>>!File! echo. MAC ............ : !MacAddress!>>!File! echo.>>!File! echo. 當前狀態 ....... : !NetWorking!(外網)>>!File! set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic Printer where "Default='TRUE'" get DriverName^,caption /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set PrinterName=%%i if !Row! == 2 set PrinterNamf=%%i ) if "%PrinterName%" neq "" ( echo.>>!File! echo.>>!File! echo.關于打印機的詳細信息如下:>>!File! echo.>>!File! echo. 名稱 ........... : !PrinterName!>>!File! echo.>>!File! echo. 型號 ........... : !PrinterNamf!>>!File! echo.>>!File! echo. 說明 ........... : 只獲取默認打印機信息>>!File! ) set Row=0 for /f "skip=2 tokens=2 delims==" %%i in ('Wmic logicaldisk where "drivetype=2" get DeviceID^,FileSystem^,FreeSpace^,Size^,VolumeName^,VolumeSerialNumber /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set U.DeviceID=%%i if !Row! == 2 set U.FileSystem=%%i if !Row! == 3 set U.FreeSpace=%%i if !Row! == 4 set U.Size=%%i if !Row! == 5 set U.VolumeName=%%i if !Row! == 6 set U.VolumeSerialNumber=%%i ) if "%U.FileSystem%"=="" set U.FileSystem=No if "%U.FreeSpace%"=="" set U.FreeSpace=0 if "%U.Size%"=="" set U.Size=0 if "%U.VolumeName%"=="" set U.VolumeName=默認值 if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=No if "%U.DeviceID%" neq "" ( call :Minus !U.Size! !U.FreeSpace! U.Used call :GetSize !U.FreeSpace! U.FreeSpace call :GetSize !U.Used! U.Used call :GetSize !U.Size! U.Size call :Space !U.FileSystem! 10 Blank.1 call :Space !U.Size! 10 Blank.2 call :Space !U.Used! 10 Blank.3 call :Space !U.FreeSpace! 10 Blank.4 call :Space !U.VolumeSerialNumber! 12 Blank.5 echo.>>!File! echo.>>!File! echo.關于可移動磁盤的詳細信息如下:>>!File! echo.>>!File! echo 盤符 格式 容量 已用 剩余 序列號 卷標>>!File! echo.>>!File! echo %U.DeviceID% %U.FileSystem%!Blank.1!!U.Size!!Blank.2!!U.Used!!Blank.3!!U.FreeSpace!!Blank.4!%U.VolumeSerialNumber%!Blank.5!%U.VolumeName%>>!File! ) set U.DeviceID= set Row=0 for /f "skip=10 tokens=2 delims==" %%i in ('Wmic logicaldisk where "drivetype=2" get DeviceID^,FileSystem^,FreeSpace^,Size^,VolumeName^,VolumeSerialNumber /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set U.DeviceID=%%i if !Row! == 2 set U.FileSystem=%%i if !Row! == 3 set U.FreeSpace=%%i if !Row! == 4 set U.Size=%%i if !Row! == 5 set U.VolumeName=%%i if !Row! == 6 set U.VolumeSerialNumber=%%i ) if "%U.FileSystem%"=="" set U.FileSystem=No if "%U.FreeSpace%"=="" set U.FreeSpace=0 if "%U.Size%"=="" set U.Size=0 if "%U.VolumeName%"=="" set U.VolumeName=默認值 if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=No if "%U.DeviceID%" neq "" ( call :Minus !U.Size! !U.FreeSpace! U.Used call :GetSize !U.FreeSpace! U.FreeSpace call :GetSize !U.Used! U.Used call :GetSize !U.Size! U.Size call :Space !U.FileSystem! 10 Blank.1 call :Space !U.Size! 10 Blank.2 call :Space !U.Used! 10 Blank.3 call :Space !U.FreeSpace! 10 Blank.4 call :Space !U.VolumeSerialNumber! 12 Blank.5 echo %U.DeviceID% %U.FileSystem%!Blank.1!!U.Size!!Blank.2!!U.Used!!Blank.3!!U.FreeSpace!!Blank.4!%U.VolumeSerialNumber%!Blank.5!%U.VolumeName%>>!File! ) set U.DeviceID= set Row=0 for /f "skip=18 tokens=2 delims==" %%i in ('Wmic logicaldisk where "drivetype=2" get DeviceID^,FileSystem^,FreeSpace^,Size^,VolumeName^,VolumeSerialNumber /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set U.DeviceID=%%i if !Row! == 2 set U.FileSystem=%%i if !Row! == 3 set U.FreeSpace=%%i if !Row! == 4 set U.Size=%%i if !Row! == 5 set U.VolumeName=%%i if !Row! == 6 set U.VolumeSerialNumber=%%i ) if "%U.FileSystem%"=="" set U.FileSystem=No if "%U.FreeSpace%"=="" set U.FreeSpace=0 if "%U.Size%"=="" set U.Size=0 if "%U.VolumeName%"=="" set U.VolumeName=默認值 if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=No if "%U.DeviceID%" neq "" ( call :Minus !U.Size! !U.FreeSpace! U.Used call :GetSize !U.FreeSpace! U.FreeSpace call :GetSize !U.Used! U.Used call :GetSize !U.Size! U.Size call :Space !U.FileSystem! 10 Blank.1 call :Space !U.Size! 10 Blank.2 call :Space !U.Used! 10 Blank.3 call :Space !U.FreeSpace! 10 Blank.4 call :Space !U.VolumeSerialNumber! 12 Blank.5 echo %U.DeviceID% %U.FileSystem%!Blank.1!!U.Size!!Blank.2!!U.Used!!Blank.3!!U.FreeSpace!!Blank.4!%U.VolumeSerialNumber%!Blank.5!%U.VolumeName%>>!File! ) set U.DeviceID= set Row=0 for /f "skip=26 tokens=2 delims==" %%i in ('Wmic logicaldisk where "drivetype=2" get DeviceID^,FileSystem^,FreeSpace^,Size^,VolumeName^,VolumeSerialNumber /value 2^>nul') do ( set /a Row+=1 if !Row! == 1 set U.DeviceID=%%i if !Row! == 2 set U.FileSystem=%%i if !Row! == 3 set U.FreeSpace=%%i if !Row! == 4 set U.Size=%%i if !Row! == 5 set U.VolumeName=%%i if !Row! == 6 set U.VolumeSerialNumber=%%i ) if "%U.FileSystem%"=="" set U.FileSystem=No if "%U.FreeSpace%"=="" set U.FreeSpace=0 if "%U.Size%"=="" set U.Size=0 if "%U.VolumeName%"=="" set U.VolumeName=默認值 if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=No if "%U.DeviceID%" neq "" ( call :Minus !U.Size! !U.FreeSpace! U.Used call :GetSize !U.FreeSpace! U.FreeSpace call :GetSize !U.Used! U.Used call :GetSize !U.Size! U.Size call :Space !U.FileSystem! 10 Blank.1 call :Space !U.Size! 10 Blank.2 call :Space !U.Used! 10 Blank.3 call :Space !U.FreeSpace! 10 Blank.4 call :Space !U.VolumeSerialNumber! 12 Blank.5 echo %U.DeviceID% %U.FileSystem%!Blank.1!!U.Size!!Blank.2!!U.Used!!Blank.3!!U.FreeSpace!!Blank.4!%U.VolumeSerialNumber%!Blank.5!%U.VolumeName%>>!File! ) echo.>>!File! echo.>>!File! echo.>>!File! echo.>>!File! echo.程序版本 ..............................: V-2.2>>!File! echo.>>!File! set Tim.2=%time% call :TimeDifference !Tim.1! !Tim.2! Difference echo.生成詳細信息耗時 ..................... : %Difference%>>!File! for /f %%i in ("%date%") do set Dat=%%i for /f "delims=." %%i in ("%Time%") do set Tim=%%i echo.>>!File! echo.此程序最后優化于 ..................... : 2020 年 03 月 18 日>>!File! echo.>>!File! echo.以上信息生成于 ........................: %Dat% %Tim%>>!File! echo.>>!File! del /a /f %Temp%\Dxdiag.dll >nul 2>nul start !File! :End Exit :Space if "%~3" == "" Goto :eof set S=%~1 set Len.2=%~2 set Space= for /l %%i in (25 -1 1) do if "!S:~%%i,1!"=="" set Len.1=%%i set /a Len.3=!Len.2!-!Len.1! for /l %%i in (1 1 !Len.3!) do set Space=!Space! set %~3=!Space! Goto :eof :GetSize set Bytes=%~1 if "%~2" == "" Goto :eof call :Division !Bytes! 1152921504606846976 OK if not "%OK:~0,2%"=="0." ( set %~2=!OK!EB Goto :eof ) else (call :Division !Bytes! 1125899906842624 OK) if not "%OK:~0,2%"=="0." ( set %~2=!OK!PB Goto :eof ) else (call :Division !Bytes! 1099511627776 OK) if not "%OK:~0,2%"=="0." ( set %~2=!OK!TB Goto :eof ) else (call :Division !Bytes! 1073741824 OK) if not "%OK:~0,2%"=="0." ( set %~2=!OK!GB Goto :eof ) else (call :Division !Bytes! 1048576 OK) if not "%OK:~0,2%"=="0." ( set %~2=!OK!MB Goto :eof ) else (call :Division !Bytes! 1024 OK) if not "%OK:~0,2%"=="0." ( set %~2=!OK!KB Goto :eof ) else ( set %~2=!Bytes!B Goto :eof) :TimeDifference set /a N=0 for /f "tokens=1-8 delims=.:" %%I in ("%~2:%~1") do ( set /a N+=10%%I%%100*360000+10%%J%%100*6000+10%%K%%100*100+10%%L%%100 set /a N-=10%%M%%100*360000+10%%N%%100*6000+10%%O%%100*100+10%%P%%100 ) set Sco=!N! set /a S=N/360000,N=N%%360000,F=N/6000,N=N%%6000,M=N/100,N=N%%100 set T=%M% 秒 %N% 毫秒 set %~3=%T% Goto :eof :Calc set Cal.1=%~1 set Cal.2=%~2 set Cal.3=0 set Cal.4= for %%i in (!Smart!) do (set /a Cal.3+=1 if !Cal.3! Geq !Cal.1! (if !Cal.3! Lss !Cal.2! set Cal.4=!Cal.4! %%i)) for /f "tokens=6,7" %%i in ("!Cal.4!") do set /a Cal.4=%%j*256+%%i set %~3=!Cal.4! Goto :eof :Inspect title 獲取硬件信息 - 正在檢測運行環境,請稍等... if %~Z0 neq 40938 Exit if /i "%systemDrive%" == "X:" Title 此程序不支持 PE 環境,請安任意鍵退出!& Pause>nul & exit Net User Guest /Active:Yes>nul 2>nul if /i %Errorlevel% neq 0 Title 當前賬戶權限不足,請以管理員身份運行!& Pause>nul & exit set Tit=關于電腦配置的簡要信息如下: set Titl=關于電腦配置的詳細信息如下: Sc Config Winmgmt Start= Auto >nul 2>nul for /f "tokens=2 delims==" %%i in ('Wmic DiskDrive Get Model /Value^|Find /i /v "USB"') do ( echo %%i>%Temp%\Temp.txt for /f %%j in ('Findstr /i "Vmware Vbox Virtual Qemu" %Temp%\Temp.txt') do ( if "%%j" neq "" (Color 03 set Tit=檢測環境處于虛擬機中,以下信息可能不準: set Titl=檢測環境處于虛擬機中,以下信息可能不準: ) ) del /a /f %Temp%\Temp.txt >nul 2>nul ) Goto :eof :Addition if "%~3"=="" Goto :eof set Add.1=%~1 set Add.2=%~2 set Add.3= set Add.3.Temp.1= set Add.3.Temp.2=0 set Add.1.Temp= for /l %%i in (25 -1 0) do (if "!Add.1:~%%i,1!"=="" set Add.1.Len=%%i if "!Add.2:~%%i,1!"=="" set Add.2.Len=%%i) if !Add.1.Len! lss !Add.2.Len! (set Add.1=%~2 set Add.2=%~1) for /l %%i in (0 1 9) do set Add.1=!Add.1:%%i=%%i ! for %%i in (!Add.1!) do set Add.1.Temp=%%i !Add.1.Temp! if %~Z0 neq 40938 Goto :End for %%i in (!Add.1.Temp!) do ( if "!Add.2!"=="" set Add.2=0 set /a Add.3.Temp.1=%%i+!Add.2:~-1!+!Add.3.Temp.2! set Add.3=!Add.3.Temp.1:~-1!!Add.3! set Add.3.Temp.2=!Add.3.Temp.1:~0,-1! if "!Add.3.Temp.2!"=="" set Add.3.Temp.2=0 set Add.2=!Add.2:~0,-1! ) if !Add.3.Temp.2! neq 0 set Add.3=!Add.3.Temp.2!!Add.3! for /f "tokens=* delims=0" %%i in ("!Add.3!") do set Add.3=%%i if "!Add.3!"=="" set Add.3=0 set %~3=!Add.3! Goto :eof :Minus if "%~3"=="" Goto :eof set Min.0=0 set Min.1=%~1 set Min.2=%~2 set Min.3= set Min.1.Temp= for /l %%i in (0 1 9) do set Min.1=!Min.1:%%i= %%i! for %%i in (!Min.1!) do set Min.1.Temp=%%i !Min.1.Temp! for %%i in (!Min.1.Temp!) do ( set Min.i=%%i if "!Min.2!"=="" set Min.2=0 if !Min.0! == 10 set /a Min.i=!Min.i!-1 if !Min.2:~-1! gtr !Min.i! (set Min.0=10) else set Min.0=0 set /a Min.3.Temp=!Min.i!+!Min.0!-!Min.2:~-1! set Min.3=!Min.3.Temp!!Min.3! set Min.2=!Min.2:~0,-1! ) for /f "tokens=* delims=0" %%i in ("!Min.3!") do set Min.3=%%i if "!Min.3!"=="" set Min.3=0 set %~3=!Min.3! Goto :eof :Division if "%~3" == "" Goto :eof setlocal set Div.1=%~1 set Div.2=%~2 set Div.3= set Dec.d=2 set Zer.O=00000000 for /l %%i in (1 1 7) do set Zer.O=!Zer.O!!Zer.O! set Halving=4096 2048 1024 512 256 128 64 32 16 8 4 2 1 for /l %%i in (1 1 2) do (set i=0& set Div.%%i.Len.2=0 for %%j in (!Div.%%i:.^= !) do ( set /a i+=1& set jj=jj%%j& set Div.%%i.Len.!i!=0 for %%k in (!Halving!) do (if "!jj:~%%k!" neq "" set /a Div.%%i.Len.!i!+=%%k& set jj=!jj:~%%k!) set /a Div.%%i.Len.0+=Div.%%i.Len.!i! ) set Div.%%i=!Div.%%i:.=! ) if !Div.1.Len.2! gtr !Div.2.Len.2! (set /a Div.2.Len.0+=Div.1.Len.2-Div.2.Len.2) else (set /a Div.1.Len.0+=Div.2.Len.2-Div.1.Len.2) for /l %%i in (1 1 2) do (set Div.%%i=!Div.%%i!!Zer.O! for %%j in (!Div.%%i.Len.0!) do set Div.%%i=!Div.%%i:~,%%j! ) for /f "tokens=* delims=0" %%i in ("!Div.2!") do set N=%%i& set Div.2=0%%i set Div.2.Len.0=1 for %%j in (!Halving!) do (if "!N:~%%j!" neq "" (set /a Div.2.Len.0+=%%j& set N=!N:~%%j!)) set /a Div.Len=Div.2.Len.0+1 if !Div.1.Len.0! lss !Div.2.Len.0! set Div.1.Len.0=!Div.2.Len.0!& set Div.1=!Zer.O:~-%Div.2.Len.0%,-%Div.1.Len.0%!!Div.1! set /a Div.1.Len.0+=Dec.d set Div.X=%~Z0 set /a Div.Y=31415+9523 if !Div.X! neq !Div.Y! goto :eof set Div.1=0!Div.1!!Zer.O:~,%Dec.d%! set Div=!Div.1:~,%Div.2.Len.0%! set i=0000000!Div.2! set /a Len=Div.2.Len.0+7 for /l %%i in (1 1 9) do (set T=0 for /l %%j in (8 8 !Len!) do (set /a T=1!i:~-%%j,8!*%%i+T set Num%%i=!T:~-8!!Num%%i! set /a T=!T:~,-8!-%%i ) set Num%%i=!T!!Num%%i! set Num%%i=0000000!Num%%i:~-%Div.Len%! ) for /l %%l in (!Div.2.Len.0! 1 !Div.1.Len.0!) do ( set Div=!Zer.O!!Div!!Div.1:~%%l,1! set Div=!Div:~-%Div.Len%! if "!Div!" geq "!Div.2!" ( set M=1& set i=0000000!Div! for /l %%i in (2 1 9) do if !i! geq !Num%%i! set M=%%i set Div.3=!Div.3!!M! set Div= set T=0 for %%i in (!M!) do ( for /l %%j in (8 8 !Len!) do ( set /a T=3!i:~-%%j,8!-1!Num%%i:~-%%j,8!-!T:~,1!%%2 set Div=!T:~1!!Div! ) ) ) else set Div.3=!Div.3!0 ) if defined Dec.d if %Dec.d% gtr 0 set Div.3=!Div.3:~,-%Dec.d%!.!Div.3:~-%Dec.d%! for /f "tokens=* delims=0" %%i in ("!Div.3!") do set Div.3=%%i if "!Div.3:~0,1!"=="." set Div.3=0!Div.3! endlocal & set %~3=%Div.3% Goto :eof
看完了這篇文章,相信你對“計算機中怎么批處理獲取硬件信息的代碼”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。