本帖最后由 gfd 于 2024-1-17 12:00 编辑
5.3更新
显示每条内存信息
显示每块硬盘信息(10进制截取GB容量)
代码如下:- @echo off&setlocal enabledelayedexpansion&title gfd硬件检测_5.3
-
- REM 日期时间
- for /f "tokens=1* delims=:=" %%a in ('"wmic os Get Caption,InstallDate,OSArchitecture,Version /value"') do (
- IF /I "%%a"=="Caption" set Caption=%%b
- IF /I "%%a"=="InstallDate" set InstallDate=%%b
- IF /I "%%a"=="OSArchitecture" set OSArchitecture=%%b
- IF /I "%%a"=="Version" set Version=%%b
- )
- echo 信息提取时间:%date% 时间 %Time%
- echo Windows_信息:%Caption%%Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒
- echo.
-
- REM 产品 csproduct
- for /f "tokens=1* delims==" %%a in ('"wmic csproduct Get IdentifyingNumber,Name,Vendor,Version /value"') do (
- IF /I "%%a"=="IdentifyingNumber" set IdenCS=%%b
- IF /I "%%a"=="Name" set NameCS=%%b
- IF /I "%%a"=="Vendor" set VendCS=%%b
- IF /I "%%a"=="Version" set VersCS=%%b
- )
- REM 主板 baseboard
- for /f "tokens=1* delims=:=" %%i in ('"wmic baseboard get Manufacturer,Product,SerialNumber /value"') do (
- IF /I "%%i"=="Manufacturer" set ManuZB=%%j
- IF /I "%%i"=="Product" set ProdZB=%%j
- IF /I "%%i"=="SerialNumber" set SeriZB=%%j
- )
- REM 系统管理 ComputerSystem
- for /f "tokens=1* delims=:=" %%i in ('"wmic ComputerSystem get Manufacturer,SystemFamily,SystemSKUNumber /value"') do (
- IF /I "%%i"=="Manufacturer" set ManuSY=%%j
- IF /I "%%i"=="SystemFamily" set FamiSY=%%j
- IF /I "%%i"=="SystemSKUNumber" set SKUNSY=%%j
- )
- echo 产品:
- echo 供应商:%VendCS%
- echo 系 列:%NameCS%
- echo 型 号:%VersCS%
- echo 序列号:%IdenCS%
- echo 主板:
- echo 制造商:%ManuZB%
- echo 产 品:%ProdZB%
- echo 序列号:%SeriZB%
- echo System:
- echo 制造商:%ManuSY%
- echo 产品线:%FamiSY%
- echo 序列号:%SKUNSY%&echo.&echo.
-
- REM 处理器
- for /f "tokens=2 delims==" %%a in ('"wmic cpu Get DeviceID /value"') do set /a CPUQuantity+=1
- for /f "tokens=1* delims==" %%a in ('"wmic cpu Get MaxClockSpeed,Name,NumberOfCores,NumberOfLogicalProcessors /value"') do (
- IF /I "%%a"=="MaxClockSpeed" set MaxClockSpeed=%%b
- IF /I "%%a"=="Name" set NameC=%%b
- IF /I "%%a"=="NumberOfCores" set NumberOfCores=%%b
- IF /I "%%a"=="NumberOfLogicalProcessors" set NumberOfLogicalProcessors=%%b
- )
- echo CPU :【%CPUQuantity% 颗】
- echo 名 称:%NameC%【%NumberOfCores%核%NumberOfLogicalProcessors%线程】
- echo 主 频:%MaxClockSpeed%&echo.&echo.
-
- REM 内存
- for /f "tokens=2 delims==" %%a in ('"wmic memorychip Get Tag /value"') do set /a MemoryQuantity+=1
- for /f "tokens=2 delims==" %%a in ('"wmic memorychip Get Capacity /value"') do (
- set Capacity=%%a
- set /a NCG=!Capacity:~,-7!/1073
- set /a m+=!NCG!
- )
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip where Tag='Physical Memory 0' Get ConfiguredClockSpeed /value"') do (
- IF /I "%%a"=="ConfiguredClockSpeed" set ConfiguredClockSpeed=%%b
- )
- echo 内存:【%MemoryQuantity% 条】
- echo 总容量:!m! GB 【当前频率:%ConfiguredClockSpeed% MHz】
- echo ----------------------------
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip Get Capacity,Manufacturer,SerialNumber,Speed /value"') do (
- IF /I "%%a"=="Capacity" (
- set Capacity=%%b
- set /a NCG=!Capacity:~,-7!/1073
- set /a NC+=1
- echo. 内存!NC! :%NCG% GB)
- IF /I "%%a"=="Manufacturer" (
- echo. 品 牌:%%b)
- IF /I "%%a"=="SerialNumber" (
- echo. 序 列 号:%%b)
- IF /I "%%a"=="Speed" (
- echo. 最高频率:%%b
- echo ----------------------------)
- )
- echo.&echo.
-
- REM 硬盘
- for /f "tokens=2 delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Caption /value"') do set /a DiskQuantity+=1
- echo 硬盘:【%DiskQuantity% 块】
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Model,SerialNumber,Size /value"') do (
- IF /I "%%a"=="Model" (
- set /a YP+=1
- echo. 硬盘 !YP!:%%b)
- IF /I "%%a"=="SerialNumber" (
- echo. 序列号:%%b)
- IF /I "%%a"=="Size" (
- set Size=%%b
- echo. 容 量:!Size:~,-10! GB
- echo ----------------------------)
- )
- echo.&echo.
-
-
- echo 显示:
- for /f "tokens=1* delims==" %%a in ('"wmic path Win32_VideoController Get CurrentRefreshRate,MaxRefreshRate,Name,VideoModeDescription /value"') do (
- IF /I "%%a"=="CurrentRefreshRate" (
- echo. 当前刷新率: %%b)
- IF /I "%%a"=="MaxRefreshRate" (
- echo. 最高刷新率: %%b)
- IF /I "%%a"=="Name" (
- echo. 显卡 名称: %%b)
- IF /I "%%a"=="VideoModeDescription" (
- echo. 当前分辨率: %%b
- echo ----------------------------)
- )
- echo.&echo.
-
- REM BIOS
- for /f "tokens=1* delims=:=" %%a in ('"wmic bios Get BIOSVersion,Manufacturer,Name,ReleaseDate,SerialNumber,SMBIOSBIOSVersion,Version /value"') do (
- IF /I "%%a"=="ReleaseDate" set ReleaseDate=%%b
- IF /I "%%a"=="SerialNumber" set SeriBI=%%b
- IF /I "%%a"=="Manufacturer" set ManuBI=%%b
- IF /I "%%a"=="Name" set NameBI=%%b
- IF /I "%%a"=="Version" set VersBI=%%b
- IF /I "%%a"=="BIOSVersion" set BIOSVersion=%%b
- IF /I "%%a"=="SMBIOSBIOSVersion" set SMBIOSBIOSVersion=%%b
- )
- echo BIOS:
- echo 制 造 商:%ManuBI%
- echo 名 称:%NameBI%
- echo 版 本:%VersBI%
- echo BIOS 版本:%BIOSVersion%
- echo SMBIOS版本:%SMBIOSBIOSVersion%
- echo 固件 日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日
- echo 序 列 号:%SeriBI%
- echo.
-
- echo 信息提取完成,按任意键保存到文本中。
- pause>nul
-
- REM ==========保存信息到文件中,如果不需要,删除下面所有==========
- (echo 信息提取时间:%date% 时间 %Time%
- echo Windows_信息:%Caption%%Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒
- echo.
- echo 产品:
- echo 供应商:%VendCS%
- echo 系 列:%NameCS%
- echo 型 号:%VersCS%
- echo 序列号:%IdenCS%
- echo 主板:
- echo 制造商:%ManuZB%
- echo 产 品:%ProdZB%
- echo 序列号:%SeriZB%
- echo System:
- echo 制造商:%ManuSY%
- echo 产品线:%FamiSY%
- echo 序列号:%SKUNSY%
- echo.)>>硬件信息gfd5.txt
- echo CPU :【%CPUQuantity% 颗】>>硬件信息gfd5.txt
- echo 名 称:%NameC%【%NumberOfCores%核%NumberOfLogicalProcessors%线程】>>硬件信息gfd5.txt
- echo 主 频:%MaxClockSpeed%>>硬件信息gfd5.txt
- echo.>>硬件信息gfd5.txt
- echo 内存:【%MemoryQuantity% 条】>>硬件信息gfd5.txt
- echo 总容量:%m% GB 【当前频率:%ConfiguredClockSpeed% MHz】>>硬件信息gfd5.txt
- echo ---------------------------->>硬件信息gfd5.txt
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip Get Capacity,Manufacturer,SerialNumber,Speed /value"') do (
- IF /I "%%a"=="Capacity" (
- set CapaTXT=%%b
- set /a NCG=!CapaTXT:~,-7!/1073
- set /a NCTXT+=1
- echo. 内存!NCTXT! :%NCG% GB>>硬件信息gfd5.txt)
- IF /I "%%a"=="Manufacturer" (
- echo. 品 牌:%%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="SerialNumber" (
- echo. 序 列 号:%%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="Speed" (
- echo. 最高频率:%%b>>硬件信息gfd5.txt
- echo ---------------------------->>硬件信息gfd5.txt))
- (echo.
- echo 硬盘:【%DiskQuantity% 块】)>>硬件信息gfd5.txt
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Model,SerialNumber,Size /value"') do (
- IF /I "%%a"=="Model" (
- set /a YPTXT+=1
- echo. 硬盘 !YPTXT!:%%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="SerialNumber" (
- echo. 序列号:%%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="Size" (
- set Size=%%b
- echo. 容 量:!Size:~,-10! GB>>硬件信息gfd5.txt
- echo ---------------------------->>硬件信息gfd5.txt))
- (echo.
- echo 显示:)>>硬件信息gfd5.txt
- for /f "tokens=1* delims==" %%a in ('"wmic path Win32_VideoController Get CurrentRefreshRate,MaxRefreshRate,Name,VideoModeDescription /value"') do (
- IF /I "%%a"=="CurrentRefreshRate" (
- echo. 当前刷新率: %%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="MaxRefreshRate" (
- echo. 最高刷新率: %%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="Name" (
- echo. 显卡 名称: %%b>>硬件信息gfd5.txt)
- IF /I "%%a"=="VideoModeDescription" (
- echo. 当前分辨率: %%b>>硬件信息gfd5.txt
- echo ---------------------------->>硬件信息gfd5.txt))
- (echo.
- echo BIOS:
- echo 制 造 商:%ManuBI%
- echo 名 称:%NameBI%
- echo 版 本:%VersBI%
- echo BIOS 版本:%BIOSVersion%
- echo SMBIOS版本:%SMBIOSBIOSVersion%
- echo 固件 日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日
- echo 序 列 号:%SeriBI%
- echo ****************************************页尾****************************************
- )>>硬件信息gfd5.txt
- echo.&echo 已保存,稍后自动退出。&echo.
- timeout /T 3 >nul
复制代码
|