时间:2021-05-22
先声明:我私下会不断的更新代码,只有大幅度更新才会上传到这里(目前核心代码基本完善)!
兼容XP Win7 Win8 win10
1.运行环境判断,若自身被修改则自动闪退;若PE环境则提示并指引退出;若虚拟机环境则提示信息获取可能不准;若非管理员权限也会截取并提示。
2.关于硬盘、内存容量的计算方面支持 字节 KB MB GB TB PB
3.由于有些电脑多网卡、显卡、声卡,此程序只获取正在使用的相关信息
4.硬盘温度,使用时间,通电次数纯批处理实现!(原创代码,转载请注明出处!)
5.纯批处理实现系统密匙获取(通过注册表中的加密数据进行解密)
以下是最新版本,不用后翻。
更新内容:
1.解决了众多网友反应的关于网卡信息获取不准的问题,目前已基本完美
2.调整了代码结构,优化了效率和逻辑顺序(基本上等于重写了一遍)
3.解决了之前多种情况遇到的闪退,现在只要不改代码基本是不会闪退的
最后声明:电脑系统情况多样且复杂并非完美版本 ,希望大家多多测试并提供BUG截图 以后会根据大家的测试结果不断更新。
本人QQ:540044977 若要获取实时最新版可以加好友索要,欢迎志同道合的朋友前来交流。
以下是代码:
@echo offmode con cols=82 lines=25Setlocal EnableDelayedExpansioncall :Inspecttitle 获取硬件信息 - 正在获取相关信息,请稍等...echo !Tit!echo .............................................................echo.DxDiag /t %Temp%\Dxdiag.dllPing mitLimit%>>!File! echo.>>!File! echo.>>!File!)echo.关于硬盘的详细信息如下:>>!File!echo.>>!File!echo. 数量 ........... : %HdQuantity% 块>>!File!echo.>>!File!set HdSize=0for /f "skip=1 delims=" %%i in ('Wmic DiskDrive Get Size') do ( set Var.i=%%i call :Addition !Var.i! !HdSize! HdSize)call :GetSize !HdSize! HdSizeif "!HdSize:~-5,3!"==".00" set HdSize=!HdSize:~0,-5! !HdSize:~-2!echo. 实际容量 .............. : !HdSize!>>!File!echo.>>!File!if "!Tit!"=="检测环境处于虚拟机中,以下信息可能不准:" Goto :Gofor /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!/24echo.>>!File!echo 硬盘 !DiskNuber!: >>!File!echo.>>!File!echo 当前硬盘温度 ..................... : !Temperature! ℃>>!File!echo.>>!File!echo 截至目前硬盘已启停 ..................... : !StartStopCount! 次>>!File!echo.>>!File!echo 截至目前硬盘已累计运行 ....................... : !PowerOnTimeCount! 小时(!Day!天)>>!File!)echo.>>!File!:Goecho.>>!File!echo. 硬盘 分区 模式 容量 状态 型号>>!File!echo.>>!File!set Row=0for /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.4if 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.4if 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=0for /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=0for /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 SoundSizefor /f %%i in ("!SoundDate!") do set SoundDate=%%ifor /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 日):NoDateandSizeecho. 输出声卡 ....... :!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=0for /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=0for /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=Noif "%U.FreeSpace%"=="" set U.FreeSpace=0if "%U.Size%"=="" set U.Size=0if "%U.VolumeName%"=="" set U.VolumeName=默认值if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=Noif "%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=0for /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=Noif "%U.FreeSpace%"=="" set U.FreeSpace=0if "%U.Size%"=="" set U.Size=0if "%U.VolumeName%"=="" set U.VolumeName=默认值if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=Noif "%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=0for /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=Noif "%U.FreeSpace%"=="" set U.FreeSpace=0if "%U.Size%"=="" set U.Size=0if "%U.VolumeName%"=="" set U.VolumeName=默认值if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=Noif "%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=0for /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=Noif "%U.FreeSpace%"=="" set U.FreeSpace=0if "%U.Size%"=="" set U.Size=0if "%U.VolumeName%"=="" set U.VolumeName=默认值if "%U.VolumeSerialNumber%"=="" set U.VolumeSerialNumber=Noif "%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.VolumeSerialN声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
显示系统信息的dos命令,使用批处理显示硬件信息的批处理这个得看你需要查看的方式.1.cmd窗口查看2.程序窗口查看3.文本查看方法1.cmd窗口查看:@ech
可以在批处理文件内的任何地方使用批处理参数,以提取有关环境设置的信息。Cmd.exe提供批处理参数扩展变量(%0到%9)。当在批处理文件中使用批处理参数时,%0
批处理隐藏运行隐藏批处理本身复制代码代码如下:@echooffif"%1"=="h"gotobeginstartmshtavbscript:createobje
批处理实例代码教程-----------------------------------------------------------------------
想了很久,发现了一种不用临时文件,在批处理中直接执行vbs的方法示例批处理:test.batCode:复制代码代码如下::OnErrorResumeNextSu