欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-09 22:44:18
先声明:我私下会不断的更新代码,只有大幅度更新才会上传到这里(目前核心代码基本完善)!兼容xp win7 win8 win10本程序特性:1.运行环境判断,若自身被修改则自动闪退;若pe环境则提示并指...

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

兼容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=铭瑄
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

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

相关标签: bat 硬件信息