当前位置:主页 > 脚本语言 > DOS/BAT >

纯批处理获取硬件信息的代码

时间:2021-02-18 11:21:17 | 栏目:DOS/BAT | 点击:

先声明:我私下会不断的更新代码,只有大幅度更新才会上传到这里(目前核心代码基本完善)!

兼容XP Win7 Win8 win10

本程序特性:

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=铭?u
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
Rem QQ:540044977 2020-04-29

说明:此程序纯批处理,且纯净绿色,也不会在生成文件中包含我的个人信息,大家不要随意修改里面的代码结构,很可能自己电脑没问题,到了别的电脑就会获取不准。

您可能感兴趣的文章:

相关文章