|
本帖最后由 享β亻寸木东 于 2024-3-3 10:18 编辑
自己用的代码,不定时更新中。
主要用途:获取电脑的序列号、配置信息,然后保存到文件中。我是卖电脑的,收集这些信息可以记录电脑序列,销售日期,方便后期的保修查询等。
代码都是东拼西凑弄来的,大神有更好的建议欢迎提出,谢谢。
5.4加qq群吧:58902001还有cmd获取显示器信息:
- @echo off
- setlocal enabledelayedexpansion
- echo 正在获取硬件基础信息(需要几分钟时间)
- set "FileDX=%temp%\dxdiag.txt"
- dxdiag /whql:off /t "%FileDX%"
- echo 正在计算
- for /f "tokens=2 delims=" %%i in ('wmic DesktopMonitor Get PNPDeviceID 2^>nul ^| findstr "DISPLAY"') do (
- set "MonitorPNP=%%i"
- )
- for /f "tokens=2*" %%i in ('findstr /c:"Monitor Name:" "%FileDX%"') do (
- set "MonitorName=%%j"
- )
- for /f "tokens=2*" %%i in ('findstr /c:"Monitor Model:" "%FileDX%"') do (
- set "MonitorModel=%%j"
- )
- if /i "!MonitorModel!" equ "Unknown" (
- for /f "tokens=2*" %%i in ('findstr /c:"Monitor Id:" "%FileDX%"') do (
- set "MonitorModel=%%j"
- )
- ) else if "!MonitorModel!" equ "" (
- set "MonitorModel=!MonitorPNP!"
- )
- for /f "tokens=3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY\!MonitorPNP!" /s ^| findstr "EDID"') do (
- set "MonitorEDID=%%i"
- )
- set "YearNum=!MonitorEDID:~34,2!"
- set "WeekNum=!MonitorEDID:~32,2!"
- set "HeightNum=!MonitorEDID:~42,2!"
- set "WidthNum=!MonitorEDID:~44,2!"
- set /a WeekNum=0x!WeekNum!*1
- set /a YearNum=0x!YearNum!*1+1990
- set /a HeightNum=0x!HeightNum!*1
- set /a WidthNum=0x!WidthNum!*1
- for /f %%i in ('powershell "[Math]::Round([Math]::Sqrt([Math]::Pow(!HeightNum!,2)+[Math]::Pow(!WidthNum!,2))*0.3937,1)"') do (
- set "MonitorSizeInch=%%i"
- )
- for /f "tokens=4" %%i in ('findstr /c:"User DPI Setting:" "%FileDX%"') do (
- set "MonitorDPI=%%i"
- )
- for /f "tokens=2*" %%i in ('findstr /c:"Native Mode:" "%FileDX%"') do (
- set "MonitorNative=%%j"
- )
- cls
- echo 名 称 : !MonitorName!
- echo 型 号 : !MonitorModel!
- echo 屏幕尺寸 : !HeightNum! X !WidthNum! 厘米 (!MonitorSizeInch! 英寸)
- echo 生产日期 : !YearNum!年第!WeekNum!周
- echo 像素密度 : !MonitorDPI! DPI
- echo 当前模式 : !MonitorNative!
- pause >nul
复制代码
5.3地址:https://www.123pan.com/s/8JFRVv-Ichtv.html提取码:1234
这电脑板载8颗内存
5.2代码
- @echo off&color e&title gfd硬件检测_5.2
- mode con cols=110 lines=70
- setlocal enabledelayedexpansion
- echo 信息提取时间:%date% 时间 %Time%
- for /f "tokens=1* delims=:=" %%a in ('"wmic os get Caption,InstallDate,OSArchitecture,Version /Format:List"') 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 Windows_信息:%Caption%%Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒
- echo.
- echo 主版:
- for /f "tokens=1* delims==" %%a in ('"wmic csproduct get IdentifyingNumber,Name,Vendor,Version /value|more +2"') do (
- IF /I "%%a"=="IdentifyingNumber" set IdentifyingNumber=%%b
- IF /I "%%a"=="Name" set Name=%%b
- IF /I "%%a"=="Vendor" set Vendor=%%b
- IF /I "%%a"=="Version" set VersionZ=%%b
- )
- echo 供应商:%Vendor%
- echo 系 列:%Name%
- echo 型 号:%VersionZ%
- echo 序列号:%IdentifyingNumber%&echo.&echo.
- REM 处理器
- for /f "tokens=2 delims==" %%a in ('"wmic cpu Get DeviceID /value"') do set /a CPUQuantity+=1
- echo CPU :【%CPUQuantity% 颗】
- 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 名 称:%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
- echo 内存:【%MemoryQuantity% 条】
- for /f "tokens=2 delims==" %%a in ('"wmic memorychip get Capacity /value"') do (
- set "Capacity=%%a"
- for /f "tokens=1 delims=." %%b in ("!Capacity:~,-7!/1073") do set /a m+=%%b
- )
- call echo 总容量:%%m%% GB
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip get ConfiguredClockSpeed /value"') do (
- IF /I "%%a" == "ConfiguredClockSpeed" set ConfiguredClockSpeed=%%b
- )
- echo 频 率:%ConfiguredClockSpeed%&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% 块】
- set "Model= 型 号:"&set "SerialNumber= 序列号:"&set "size= 容 量:"
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' get Model,SerialNumber,Size /value|more +2"') do echo. !%%a!%%b
- echo 显示:
- for /f "tokens=1* delims==" %%a in ('"wmic path Win32_VideoController get CurrentRefreshRate,DeviceID,MaxRefreshRate,MinRefreshRate,Name,VideoModeDescription /value"') do (
- IF /I "%%a"=="CurrentRefreshRate" (
- echo. 当前刷新率: %%b)
- IF /I "%%a"=="DeviceID" (
- echo. 设 备 ID: %%b)
- IF /I "%%a"=="MaxRefreshRate" (
- echo. 最高刷新率: %%b)
- IF /I "%%a"=="MinRefreshRate" (
- echo. 最低刷新率: %%b)
- IF /I "%%a"=="Name" (
- echo. 显卡 名称: %%b)
- IF /I "%%a"=="VideoModeDescription" (
- echo. 当前分辨率: %%b
- echo ----------------------------)
- )
- echo.&echo.
- echo BIOS:
- for /f "tokens=1* delims=:=" %%a in ('"wmic bios get BIOSVersion,Manufacturer,Name,ReleaseDate,SerialNumber,SMBIOSBIOSVersion,Version /Format:List"') do (
- IF /I "%%a"=="ReleaseDate" set ReleaseDate=%%b
- IF /I "%%a"=="SerialNumber" set SerialNumberB=%%b
- IF /I "%%a"=="Manufacturer" set Manufacturer=%%b
- IF /I "%%a"=="Name" set NameB=%%b
- IF /I "%%a"=="Version" set VersionB=%%b
- IF /I "%%a"=="BIOSVersion" set BIOSVersion=%%b
- IF /I "%%a"=="SMBIOSBIOSVersion" set SMBIOSBIOSVersion=%%b
- )
- echo 制 造 商:%Manufacturer%
- echo 名 称:%NameB%
- echo 版 本:%VersionB%
- echo BIOS 版本:%BIOSVersion%
- echo SMBIOS版本:%SMBIOSBIOSVersion%
- echo 固件 日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日
- echo 序 列 号:%SerialNumberB%
- echo.
- echo 信息提取完成,按任意键保存到文本中。
- pause>nul
- REM ==========保存信息到文件中,如果不需要,删除下面所有==========
- echo 信息提取时间:%date% 时间 %Time%>>wmic硬件信息gfd.txt
- echo Windows_信息:%Caption%%Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒>>wmic硬件信息gfd.txt
- echo.>>wmic硬件信息gfd.txt
- echo 主版:>>wmic硬件信息gfd.txt
- echo 供应商:%Vendor%>>wmic硬件信息gfd.txt
- echo 系 列:%Name%>>wmic硬件信息gfd.txt
- echo 型 号:%VersionZ%>>wmic硬件信息gfd.txt
- echo 序列号:%IdentifyingNumber%>>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- REM 处理器
- echo CPU :【%CPUQuantity% 颗】>>wmic硬件信息gfd.txt
- echo 名 称:%NameC%【%NumberOfCores%核%NumberOfLogicalProcessors%线程】>>wmic硬件信息gfd.txt
- echo 主 频:%MaxClockSpeed%>>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- REM 内存
- echo 内存:【%MemoryQuantity% 条】>>wmic硬件信息gfd.txt
- echo 总容量:%m% GB>>wmic硬件信息gfd.txt
- echo 频 率:%ConfiguredClockSpeed%>>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- REM 硬盘
- echo 硬盘:【%DiskQuantity% 块】>>wmic硬件信息gfd.txt
- set "Model= 型 号:"&set "SerialNumber= 序列号:"&set "size= 容 量:"
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' get Model,SerialNumber,Size /value|more +2"') do echo. !%%a!%%b>>wmic硬件信息gfd.txt
- echo 显示:>>wmic硬件信息gfd.txt
- for /f "tokens=1* delims==" %%a in ('"wmic path Win32_VideoController get CurrentRefreshRate,DeviceID,MaxRefreshRate,MinRefreshRate,Name,VideoModeDescription /value"') do (
- IF /I "%%a"=="CurrentRefreshRate" (
- echo. 当前刷新率: %%b>>wmic硬件信息gfd.txt)
- IF /I "%%a"=="DeviceID" (
- echo. 设 备 ID: %%b>>wmic硬件信息gfd.txt)
- IF /I "%%a"=="MaxRefreshRate" (
- echo. 最高刷新率: %%b>>wmic硬件信息gfd.txt)
- IF /I "%%a"=="MinRefreshRate" (
- echo. 最低刷新率: %%b>>wmic硬件信息gfd.txt)
- IF /I "%%a"=="Name" (
- echo. 显卡 名称: %%b>>wmic硬件信息gfd.txt)
- IF /I "%%a"=="VideoModeDescription" (
- echo. 当前分辨率: %%b>>wmic硬件信息gfd.txt
- echo ---------------------------->>wmic硬件信息gfd.txt)
- )
- echo. >>wmic硬件信息gfd.txt
- echo. >>wmic硬件信息gfd.txt
- echo BIOS:>>wmic硬件信息gfd.txt
- echo 制 造 商:%Manufacturer%>>wmic硬件信息gfd.txt
- echo 名 称:%NameB%>>wmic硬件信息gfd.txt
- echo 版 本:%VersionB%>>wmic硬件信息gfd.txt
- echo BIOS 版本:%BIOSVersion%>>wmic硬件信息gfd.txt
- echo SMBIOS版本:%SMBIOSBIOSVersion%>>wmic硬件信息gfd.txt
- echo 固件 日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日>>wmic硬件信息gfd.txt
- echo 序 列 号:%SerialNumberB%>>wmic硬件信息gfd.txt
- echo ****************************************页尾****************************************>>wmic硬件信息gfd.txt
复制代码
|
评分
-
查看全部评分
|