[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程批处理在线视频分享
返回列表 发帖
回复 1# winload


   看起来不错哦,学习学习

TOP

错误导致闪退

TOP

为什么cpu参数不对啊!a6-3650明明是四核的显示一核心?、

TOP

回复 18# 宏城


    核心数确实存在有些不兼容,inter和amd的U获取方式不好达到统一,近来一直没时间折腾。最关键的是系统的版本,尤其一些过度精简的Ghost系统

TOP

RE: 原创首发,纯批处理获取硬件信息

本帖最后由 winload 于 2018-2-11 09:23 编辑

最新优化版:
  1. @echo off
  2. call :Inspect
  3. title 获取硬件信息 - 正在获取相关信息,请稍等...
  4. call :Net
  5. Setlocal EnableDelayedExpansion
  6. echo !Tit!
  7. echo .............................................................
  8. echo.
  9. if not exist "%Temp%\DxDiag.txt" DxDiag /t %Temp%\DxDiag.txt
  10. :DxDiag
  11. if exist "%Temp%\DxDiag.txt" (
  12. Attrib +h %Temp%\DxDiag.txt
  13. Ping 127.1 >nul
  14. for /f "tokens=2 delims=:" %%i in (%Temp%\DxDiag.txt) do (
  15. set /a N.1+=1
  16. if !N.1! Equ 3 (
  17. for /f "delims=(" %%j in ("%%i") do set OS=%%j
  18. ) )
  19. ) else (ping 127.1 >nul
  20. goto :DxDiag
  21. )
  22. title 获取硬件信息 - %OS%
  23. for /f "tokens=2 delims=:" %%i in (%Temp%\DxDiag.txt) do (
  24. set /a N.2+=1
  25. if !N.2! Equ 8 (for /f "delims=," %%j in ("%%i") do set CPU=%%j))
  26. echo.CPU  .......%CPU%
  27. echo.
  28. for /f "tokens=2 delims==" %%i in ('Wmic Baseboard Get Manufacturer /Value') do set Manufacturer=%%i
  29. for /f "tokens=2 delims==" %%i in ('Wmic Baseboard Get Product /Value') do set Product=%%i
  30. echo.主板 ....... %Manufacturer%   (%Product%)
  31. echo.
  32. for /f %%i in ('Wmic Path Win32_PhysicalMemory Get BankLabel^|find /i /c "Bank"') do set N.3=%%i
  33. set /a N.3-=1
  34. set Size.1=0
  35. for /f "skip=1 delims=" %%i in ('Wmic Path Win32_PhysicalMemory Get Capacity') do (
  36. set Memory=%%i
  37. call :Addition !Memory! !Size.1! Size.1
  38. )
  39. call :GetSize !Size.1! Size.1
  40. if "!Size.1:~-5,3!"==".00" set Size.1=!Size.1:~0,-5! !Size.1:~-2!
  41. echo.内存 ....... %N.3% 条   %Size.1%
  42. echo.
  43. for /f "tokens=2 delims==" %%i in ('Wmic DiskDrive Get Model /Value^|find /i /v "USB"') do (
  44. set /a N.4+=1
  45. if !N.4! Equ 1 set FirstDisk=%%i
  46. )
  47. echo.硬盘 ....... %N.4% 块   %FirstDisk% (主)
  48. echo.
  49. for /f "tokens=2 delims==" %%i in ('Wmic Path Win32_VideoController Get Name^,AdapterRam^,AdapterCompatibility^,DriverDate^,DriverVersion^,VideoProcessor
  50. /Value') do (
  51. set /a N.5+=1
  52. if !N.5! == 1 set AdapterCompatibility=%%i
  53. if !N.5! == 2 set AdapterRam=%%i
  54. if !N.5! == 3 set DriverDate=%%i
  55. if !N.5! == 4 set DriverVersion=%%i
  56. if !N.5! == 5 set Name=%%i
  57. if !N.5! == 6 set VideoProcessor=%%i
  58. )
  59. if "%AdapterRam%"=="" (set AdapterRam=无法获取显存) else (
  60. call :GetSize %AdapterRam% AdapterRam
  61. if "!AdapterRam:~-5,3!"==".00" set AdapterRam=!AdapterRam:~0,-5! !AdapterRam:~-2!
  62. )
  63. set DriverDate=%DriverDate:~0,4% 年 %DriverDate:~4,2% 月 %DriverDate:~6,2% 日
  64. if "!AdapterRam!"=="无法获取显存" (echo.显卡 ....... %Name%) else (echo.显卡 ....... %Name%  %AdapterRam% 显存)
  65. echo.
  66. for /f "tokens=2 delims==" %%i in ('Wmic DesktopMonitor Get PNPDeviceID /Value') do (
  67. for /f "delims=\ tokens=2" %%j in ("%%i") do set DisplayName=%%j
  68. )
  69. for /f "tokens=2 delims=:" %%i in ('find /i "current mode" %Temp%\DxDiag.txt') do set Resolution=%%i
  70. if "%DisplayName%"=="" (echo.屏幕 .......!Resolution!) else (echo.屏幕 ....... !DisplayName! !Resolution!)
  71. echo.
  72. for /f "delims== tokens=2" %%i in ('Wmic Path Win32_CDRomDrive Get Name /Value 2^>nul') do (
  73. set /a N.6+=1
  74. if !N.6! Equ 1  set CD-ROM.1=%%i
  75. if !N.6! Equ 2  set CD-ROM.2=; %%i
  76. )
  77. if "%CD-ROM.1%"=="" set CD-ROM.1=无
  78. echo.光驱 ....... %CD-ROM.1% %CD-ROM.2%
  79. echo.
  80. for /f "tokens=2 delims==" %%i in ('Wmic Sounddev Get ProductName /Value 2^>nul') do (
  81. set /a N.7+=1
  82. if !N.7! Equ 1  set Sound.1=%%i
  83. if !N.7! Equ 2  set Sound.2=; %%i
  84. )
  85. if "%Sound.1%"=="" set Sound.1=没有发现声卡 可能已被卸载
  86. echo 声卡 ....... %Sound.1% %Sound.2%
  87. echo.
  88. echo 网卡 ....... %NetName% (%NetWorking%)
  89. echo.
  90. echo.
  91. Rem 2016.03.21
  92. set /p 540044977=若要生成详细的电脑配置信息文件请直接回车:
  93. if "!540044977!"=="1" Goto :CpuTest
  94. :Star
  95. Title 获取硬件信息 - 正在生成详细信息,请稍等...
  96. if "!Titl!" neq "检测环境处于虚拟机中,以下信息可能不准:" Color 08
  97. set Tim.1=%Time%
  98. set File=%ComputerName%.Txt
  99. echo %Titl%>!File!
  100. echo ............................................................. >>!File!
  101. echo.>>!File!
  102. echo.关于 CPU 的详细信息如下:>>!File!
  103. echo.>>!File!
  104. echo.    名称 ........... :%CPU%>>!File!
  105. echo.>>!File!
  106. Rem 以下两种方法只针对 Inter CPU 有效,所以舍弃:
  107. Rem ---------------------------------------------------------
  108. Rem for /f "delims== tokens=2" %%i in ('Wmic ComputerSystem Get NumberOfProcessors /Value') do set NumberOfProcessors=%%i
  109. Rem for /f "tokens=2 delims==" %%i in ('Wmic CPU Get DeviceID /Value') do set /a NumberOfProcessors+=1
  110. Rem ---------------------------------------------------------
  111. set NumberOfProcessors=-1
  112. for /f "tokens=2 delims==" %%i in ('wmic path Win32_PerfFormattedData_PerfOS_Processor get PercentProcessorTime /Value 2^>NUL') do set /a
  113. NumberOfProcessors+=1
  114. if "!NumberOfProcessors!" equ "-1" (
  115. for /f "delims== tokens=2" %%i in ('Wmic ComputerSystem Get NumberOfProcessors /Value') do set NumberOfProcessors=%%i
  116. )
  117. echo.    核心 ........... : %NumberOfProcessors% 核心>>!File!
  118. echo.>>!File!
  119. if "!Score!" Neq "" (echo.    跑分 ........... : !Score! 分>>!File!
  120.      echo.>>!File!)
  121. for /f "delims== tokens=2" %%i in ('Wmic CPU Get CurrentClockSpeed /Value') do set CurrentClockSpeed=%%i
  122. echo.    主频 ........... : %CurrentClockSpeed% Mhz>>!File!
  123. echo.>>!File!
  124. for /f "delims== tokens=2" %%i in ('Wmic CPU Get ExtClock /Value') do set ExtClock=%%i
  125. echo.    外频 ........... : %ExtClock% Mhz>>!File!
  126. echo.>>!File!
  127. for /f "Skip=1" %%i in ('Wmic Path Win32_CacheMemory Get MaxCacheSize') do (
  128. set /a N.8+=1
  129. if !N.8! Equ 1 set /a One=%%i
  130. if !N.8! Equ 2 set /a Two=%%i
  131. if !N.8! Equ 3 set /a Three=%%i
  132. )
  133. if /i !One! Equ 0 set One=0
  134. if /i !Two! Equ 0 set Two=0
  135. if /i !Three! Equ 0 set Three=0
  136. echo.    一级缓存 ....... : %One% KB>>!File!
  137. echo.>>!File!
  138. echo.    二级缓存 ....... : %Two% KB>>!File!
  139. echo.>>!File!
  140. echo.    三级缓存 ....... : %Three% KB>>!File!
  141. echo.>>!File!
  142. for /f "delims== tokens=2" %%i in ('Wmic CPU Get SocketDesignation /Value') do set SocketDesignation=%%i
  143. echo.    插槽 ........... : %SocketDesignation%>>!File!
  144. echo.>>!File!
  145. for /f "delims== tokens=2*" %%i in ('Wmic CPU Get ProcessorID /Value') do set ProcessorID=%%i
  146. echo.    编号 ........... : %ProcessorID%>>!File!
  147. echo.>>!File!
  148. echo.>>!File!
  149. echo.关于主板的详细信息如下:>>!File!
  150. echo.>>!File!
  151. echo.    品牌 ........... : %Manufacturer%>>!File!
  152. echo.>>!File!
  153. echo.    型号 ........... : %Product%>>!File!
  154. echo.>>!File!
  155. for /f "delims== tokens=2" %%i in ('Wmic Baseboard Get SerialNumber /Value') do set SerialNumber=%%i
  156. echo.    编号 ........... : %SerialNumber%>>!File!
  157. echo.>>!File!
  158. for /f "delims== tokens=2" %%i in ('Wmic Baseboard Get Version /Value') do set Version=%%i
  159. echo.    版本 ........... : %Version%>>!File!
  160. echo.>>!File!
  161. for /f "tokens=2 delims==" %%i in ('Wmic Memphysical Get MaxCapacity /Value') do set MaxCapacity=%%i
  162. set /a MaxCapacity/=1048576
  163. echo.    内存支持 ....... : %MaxCapacity% GB>>!File!
  164. echo.>>!File!
  165. for /f "delims== tokens=2" %%i in ('Wmic bios Get ReleaseDate /Value') do set ReleaseDate=%%i
  166. set ReleaseDate=%ReleaseDate:~0,4% 年 %ReleaseDate:~4,2% 月 %ReleaseDate:~6,2% 日
  167. echo.    出厂日期 ....... : %ReleaseDate%>>!File!
  168. echo.>>!File!
  169. for /f "delims== tokens=2" %%i in ('Wmic bios Get SmbiosbioSversion /Value') do set SmbiosbioSversion=%%i
  170. echo.    BIOS 版本 ...... : %SmbiosbioSversion%>>!File!
  171. echo.>>!File!
  172. for /f "delims== tokens=2" %%i in ('Wmic bios Get InstallableLanguages /Value') do set InstallableLanguages=%%i
  173. if %InstallableLanguages% Equ 1 (set InstallableLanguages=英文界面) else set InstallableLanguages=!InstallableLanguages! 国语言
  174. echo.    BIOS 语言 ...... : %InstallableLanguages%>>!File!
  175. echo.>>!File!
  176. for /f "delims== tokens=2" %%i in ('Wmic bios Get Manufacturer /Value') do set Manufacturer=%%i
  177. echo.    BIOS 制造商 .... : %Manufacturer%>>!File!
  178. echo.>>!File!
  179. echo.>>!File!
  180. echo.关于内存的详细信息如下:>>!File!
  181. echo.>>!File!
  182. echo.    数量 ........... : %N.3% 条>>!File!
  183. echo.>>!File!
  184. echo.    总容量 ......... : %Size.1%>>!File!
  185. echo.>>!File!
  186. echo.>>!File!
  187. echo.    内存     容量         频率      插槽>>!File!
  188. echo.>>!File!
  189. for /f "skip=1 delims=" %%i in ('Wmic Path Win32_PhysicalMemory Get DeviceLocator^,Capacity^,Speed') do (
  190. set /a N.9+=1
  191. set Var.i=%%i
  192. for /f "tokens=1,2,3" %%j in ("!Var.i!") do (
  193. set Var.j=%%j
  194. set Var.k=%%k
  195. set Var.l=%%l
  196. )
  197. if "!Var.l!"=="" set Var.l=NotGet
  198. call :GetSize !Var.j! Var.jj
  199. call ::Space !Var.l!  10 S.1
  200. call ::Space !Var.jj! 13 S.2
  201. if not "!Var.i:~1,1!"== "" echo.    !N.9!        !Var.jj!!S.2!!Var.l!!S.1!!Var.k!>>!File!
  202. )
  203. echo.>>!File!
  204. echo.>>!File!
  205. for /f "tokens=2 delims==" %%i in ('wmic path Win32_PerfFormattedData_PerfOS_Memory get AvailableBytes /Value 2^>NUL') do set Available=%%i
  206. if "!Available!" neq "" call :GetSize !Available! Available
  207. for /f "tokens=2 delims==" %%i in ('wmic path Win32_PerfFormattedData_PerfOS_Memory get CommittedBytes /Value 2^>NUL') do set Committed=%%i
  208. if "!Committed!" neq "" call :GetSize !Committed! Committed
  209. for /f "tokens=2 delims==" %%i in ('wmic path Win32_PerfFormattedData_PerfOS_Memory get CommitLimit /Value 2^>NUL') do set CommitLimit=%%i
  210. if "!CommitLimit!" neq "" call :GetSize !CommitLimit! CommitLimit
  211. if "!Available!" neq "" (
  212. echo.    已用内存 : %Committed%    可用内存 : %Available%    提交限制 : %CommitLimit%>>!File!
  213. echo.>>!File!
  214. echo.>>!File!
  215. )
  216. echo.关于硬盘的详细信息如下:>>!File!
  217. echo.>>!File!
  218. echo.    数量 ........... : %N.4% 块>>!File!
  219. echo.>>!File!
  220. set Size.2=0
  221. for /f "skip=1 delims=" %%i in ('Wmic DiskDrive Get Size') do (
  222. set Var.i=%%i
  223. call :Addition !Var.i! !Size.2! Size.2
  224. )
  225. call :GetSize !Size.2! Size.2
  226. if "!Size.2:~-5,3!"==".00" set Size.2=!Size.2:~0,-5! !Size.2:~-2!
  227. echo.    总容量 ............... : !Size.2!>>!File!
  228. echo.>>!File!
  229. if "!Tit!"=="检测环境处于虚拟机中,以下信息可能不准:" goto :Go
  230. for /f "tokens=2 delims==" %%i in ('Wmic /NameSpace:\\root\wmi Path MSStorageDriver_ATAPISmartData get VendorSpecific /Value 2^>Nul') do (
  231. set /a DiskNuber+=1
  232. set Smart=%%i
  233. set Smart=!Smart:,= !
  234. for /l %%j in (3 12 362) do (
  235. set Nu.1=0
  236. for %%k in (!Smart!) do (
  237. set /a Nu.1+=1
  238. if !Nu.1! Equ %%j (
  239. if %%k Equ 9 (set /a Nu.2=!Nu.1!+7
  240.       call :Calc !Nu.1! !Nu.2! PowerOnTimeCount)
  241. if %%k Equ 12 (set /a Nu.2=!Nu.1!+7
  242.        call :Calc !Nu.1! !Nu.2! StartStopCount)
  243. set /a Nu.3=0,Nu.4=0
  244. if %%k Equ 190 (set /a Nu.3=!Nu.1!+5
  245. for %%l in (!Smart!) do (
  246. set /a Nu.4+=1
  247. if !Nu.4! Equ !Nu.3! set Temperature=%%l
  248. )
  249. ) else (
  250. if %%k Equ 194 (set /a Nu.3=!Nu.1!+5
  251. for %%l in (!Smart!) do (
  252. set /a Nu.4+=1
  253. if !Nu.4! Equ !Nu.3! set Temperature=%%l
  254. )
  255. )
  256. )
  257. )
  258. )
  259. )
  260. set /a Day=!PowerOnTimeCount!/24
  261. echo.>>!File!
  262. echo     硬盘 !DiskNuber!: >>!File!
  263. echo.>>!File!
  264. echo     当前硬盘温度 ..................... : !Temperature! ℃>>!File!
  265. echo.>>!File!
  266. echo     截至目前硬盘已启停:..................... : !StartStopCount! 次>>!File!
  267. echo.>>!File!
  268. echo     截至目前硬盘已累计运行 ..................... : !PowerOnTimeCount! 小时(!Day!天)>>!File!
  269. )
  270. echo.>>!File!
  271. :Go
  272. echo.>>!File!
  273. echo.    硬盘    分区     模式        容量        状态        型号>>!File!
  274. echo.>>!File!
  275. for /f "skip=1 delims=" %%i in ('Wmic DiskDrive Get Partitions^,InterFacetype^,Size^|find /i /v "USB"') do (
  276. set /a Num.1+=1
  277. set Var.i=%%i
  278. for /f "tokens=1,2,3" %%j in ("!Var.i!") do (
  279. set Var.j=%%j
  280. set Var.k=%%k
  281. set Var.l=%%l
  282. )
  283. set Num.2=0
  284. for /f "skip=1 delims=" %%m in ('Wmic DiskDrive Get Caption^|find /i /v "USB"') do (
  285. set /a Num.2+=1
  286. if !Num.2! Equ !Num.1! set Var.m=%%m
  287. )
  288. set Var.mm=
  289. for %%n in (!Var.m!) do set Var.mm=!Var.mm!%%n
  290. if !Num.1! Equ 1 (set Var.n=主盘) else (set Var.n=从盘)
  291. call :GetSize !Var.l! Var.ll
  292. call :Space !Num.1!  8 S.0
  293. call :Space !Var.k!  9 S.1
  294. call :Space !Var.j!  12 S.2
  295. call :Space !Var.ll! 12 S.3
  296. if not "!Var.i:~1,1!"=="" echo.    !Num.1!!S.0!!Var.k!!S.1!!Var.j!!S.2!!Var.ll!!S.3!!Var.n!        !Var.m!>>!File!
  297. )
  298. echo.>>!File!
  299. echo.>>!File!
  300. echo.    盘符    格式     容量        已用        剩余        卷标>>!File!
  301. echo.>>!File!
  302. for /f "skip=1 delims=" %%i in ('Wmic LogicalDisk Where Mediatype^='12' Get DeviceID^,FileSystem^,Size^,FreeSpace^,VolumeName') do (
  303. set Var.i=%%i
  304. for /f "tokens=1,2,3,4,*" %%j in ("!Var.i!") do (
  305. set Var.j=%%j
  306. set Var.k=%%k
  307. set Var.l=%%l
  308. set Var.m=%%m
  309. set Var.n=%%n
  310. if "!Var.n!"=="" set Var.n=默认值
  311. )
  312. call :Minus !Var.m! !Var.l! Var.o
  313. call :GetSize !Var.l! Var.ll
  314. call :GetSize !Var.m! Var.mm
  315. call :GetSize !Var.o! Var.oo
  316. if "!Var.ll:~-5,3!"==".00" set Var.ll=!Var.ll:~0,-5!!Var.ll:~-2!
  317. if "!Var.mm:~-5,3!"==".00" set Var.mm=!Var.mm:~0,-5!!Var.mm:~-2!
  318. if "!Var.oo:~-5,3!"==".00" set Var.oo=!Var.oo:~0,-5!!Var.oo:~-2!
  319. call :Space !Var.k!   9 S.1
  320. call :Space !Var.mm! 12 S.2
  321. call :Space !Var.oo! 12 S.3
  322. call :Space !Var.ll! 12 S.4
  323. if not "!Var.i:~3,1!"=="" echo.    !Var.j!      !Var.k!!S.1!!Var.mm!!S.2!!Var.oo!!S.3!!Var.ll!!S.4!!Var.n!>>!File!
  324. )
  325. echo.>>!File!
  326. echo.>>!File!
  327. echo.关于显卡的详细信息如下:>>!File!
  328. echo.>>!File!
  329. echo.    名称 ........... : %Name%>>!File!
  330. echo.>>!File!
  331. echo.    制造商 ......... : %AdapterCompatibility%>>!File!
  332. echo.>>!File!
  333. if "%VideoProcessor%"=="" set VideoProcessor=无法获取芯片信息
  334. echo.    芯片类型 ....... : %VideoProcessor%>>!File!
  335. echo.>>!File!
  336. echo.    显存 ........... : %adapterram%>>!File!
  337. echo.>>!File!
  338. echo.    当前模式 ....... :%Resolution%>>!File!
  339. echo.>>!File!
  340. echo.    驱动版本 ....... : %DriverVersion%>>!File!
  341. echo.>>!File!
  342. echo.    驱动日期 ....... : %DriverDate%>>!File!
  343. echo.>>!File!
  344. echo.>>!File!
  345. echo.关于显示器的详细信息如下:>>!File!
  346. echo.>>!File!
  347. if "%DisplayName%" == "" set DisplayName=未能获取显示器名称
  348. echo.    名称 ........... : %DisplayName% >>!File!
  349. echo.>>!File!
  350. echo.    当前模式 ....... :%Resolution%>>!File!
  351. for /f "tokens=2 delims==" %%i in ('Wmic DesktopMonitor Get Description /Value') do set Displaydescription=%%i
  352. echo.>>!File!
  353. echo.    类型 ........... : %Displaydescription%>>!File!
  354. if not "%CD-ROM.1%"=="无" (
  355. echo.>>!File!
  356. echo.>>!File!
  357. echo.关于光驱的详细信息如下:>>!File!
  358. echo.>>!File!
  359. echo.  列出所有光驱: >>!File!
  360. echo.>>!File!
  361. echo.    盘符   类型       型号 >>!File!
  362. echo.>>!File!
  363. for /f  "skip=1 delims=" %%i in ('Wmic CdRom Get Name^,Drive^,Mediatype') do echo.    %%i>>!File!
  364. )
  365. if not "%Sound.1%"=="没有发现声卡 可能已被卸载" (
  366. echo.>>!File!
  367. echo.>>!File!
  368. echo.关于声卡的详细信息如下:>>!File!
  369. echo.>>!File!
  370. echo.  列出所有声卡: >>!File!
  371. echo.>>!File!
  372. for /f "delims== tokens=2" %%i in ('Wmic Sounddev Get ProductName /Value') do (
  373. set /a N.10+=1
  374. echo.    !N.10!.  %%i>>!File!
  375. )
  376. echo.>>!File!
  377. echo.  当前声卡信息: >>!File!
  378. echo.>>!File!
  379. for /f "tokens=2 delims=:" %%i in ('find /i "Description" %Temp%\DxDiag.txt') do (
  380. set /a N.11+=1
  381. if !N.11! Equ 2 set Description=%%i
  382. )
  383. for /f "tokens=2 delims=:" %%i in ('find /i "Driver Version" %Temp%\DxDiag.txt') do (
  384. set /a N.12+=1
  385. if !N.12! Equ 3 set SoundDriverVersion=%%i
  386. )
  387. for /f "tokens=1,* delims=:" %%i in ('find /i "Date and Size" %Temp%\DxDiag.txt') do (
  388. for /f "tokens=1,2 delims=," %%k in ("%%j") do (
  389. set SoundDate=%%k
  390. set SoundSize=%%l
  391. ))
  392. for /f %%i in ("!SoundSize!") do call :GetSize %%i SoundSize
  393. for /f %%i in ("!SoundDate!") do set SoundDate=%%i
  394. for /f "tokens=1,2,3 delims=/" %%i in ("!SoundDate!") do set SoundDate=%%k 年 %%j 月 %%i 日
  395. if "!description!"==" " (
  396. set Description= 无法获取 声卡已被禁用
  397. set SoundDriverVersion= 无法获取 声卡已被禁用
  398. set SoundDate=无法获取 声卡已被禁用
  399. set SoundSize=无法获取 声卡已被禁用
  400. )
  401. echo.    输出声卡 ....... :!Description!>>!File!
  402. echo.>>!File!
  403. echo.    驱动版本 ....... :!SoundDriverVersion!>>!File!
  404. echo.>>!File!
  405. echo.    驱动日期 ....... : !SoundDate!>>!File!
  406. echo.>>!File!
  407. echo.    驱动大小 ....... : !SoundSize!>>!File!
  408. )
  409. if not "%NetName%"=="没有发现网卡 可能已被卸载" (
  410. echo.>>!File!
  411. echo.>>!File!
  412. echo.关于网卡的详细信息如下:>>!File!
  413. echo.>>!File!
  414. echo.    名称 ........... : !NetName!>>!File!
  415. echo.>>!File!
  416. echo.    MAC  ........... : !MacAddress!>>!File!
  417. )
  418. if not "%MacAddress%"=="无法获取 网卡已被禁用" (
  419. for /f "tokens=2 delims={}" %%i in ('Wmic Nicconfig where "ipenabled='True'" Get ipaddress/Value') do set "IP=%%~i"
  420. for /f delims^=^" %%i in ("!IP!") do set IP=%%~i
  421. echo.>>!File!
  422. echo.    内网 IP ........ : !IP!>>!File!
  423. )
  424. echo.>>!File!
  425. echo.    当前状态 ....... : !NetWorking!>>!File!
  426. echo.>>!File!
  427. echo.>>!File!
  428. echo.>>!File!
  429. for /f "tokens=2 delims==" %%i in ('Wmic OS Get InstallDate /Value') do (
  430. set I=%%i
  431. set InstallDate=!I:~0,4! 年 !I:~4,2! 月 !I:~6,2! 日
  432. )
  433. echo 系统版本:............................. :!OS!>>!File!
  434. echo.>>!File!
  435. echo 系统初始安装日期:..................... : !InstallDate!>>!File!
  436. echo.>>!File!
  437. set Tim.2=%time%
  438. call :TimeDifference !Tim.1! !Tim.2! Difference
  439. echo.生成详细信息耗时:..................... : %Difference%>>!File!
  440. for /f %%i in ("%date%") do set Dat=%%i
  441. for /f "delims=." %%i in ("%Time%") do set Tim=%%i
  442. echo.>>!File!
  443. echo.此程序最后优化于:..................... : 2018 年 02 月 10 日>>!File!
  444. echo.>>!File!
  445. echo.以上信息生成于:%Dat% %Tim%>>!File!
  446. echo.>>!File!
  447. start !File!
  448. del /a /f %Temp%\DxDiag.txt
  449. Exit
  450. :Space
  451. set S=%~1
  452. set Len.2=%~2
  453. set Space=
  454. for /l %%i in (10 -1 1) do if "!S:~%%i,1!"=="" set Len.1=%%i
  455. set /a Len.3=!Len.2!-!Len.1!
  456. for /l %%i in (1 1 !Len.3!) do set Space=!Space!
  457. set %~3=!Space!
  458. goto :eof
  459. :Minus
  460. set Min.0=0
  461. set Min.1=%~1
  462. set Min.2=%~2
  463. set Min.3=
  464. set Min.1.Temp=
  465. for /l %%i in (0 1 9) do set Min.1=!Min.1:%%i= %%i!
  466. for %%i in (!Min.1!) do set Min.1.Temp=%%i !Min.1.Temp!
  467. set Min.1=!Min.1.Temp!
  468. for %%i in (!Min.1!) do (
  469. set Min.i=%%i
  470. if "!Min.2!"=="" set Min.2=0
  471. if !Min.0! Equ 10 set /a Min.i=!Min.i!-1
  472. if !Min.2:~-1! gtr !Min.i! (set Min.0=10) else set Min.0=0
  473. set /a Min.3.Temp=!Min.i!+!Min.0!-!Min.2:~-1!
  474. set Min.3=!Min.3.Temp!!Min.3!
  475. set Min.2=!Min.2:~0,-1!
  476. )
  477. for /f "tokens=* delims=0" %%i in ("!Min.3!") do set Min.3=%%i
  478. if "!Min.3!"=="" set Min.3=0
  479. set %~3=!Min.3!
  480. goto :eof
  481. :Addition
  482. set Add.1=%~1
  483. set Add.2=%~2
  484. set Add.3=
  485. if "%~3"=="" goto :eof
  486. set Add.3.Temp.1=
  487. set Add.3.Temp.2=0
  488. set Add.1.Temp=
  489. for /l %%i in (64 -1 0) do (if "!Add.1:~%%i,1!"=="" set Add.1.Len=%%i
  490.     if "!Add.2:~%%i,1!"=="" set Add.2.Len=%%i)
  491. if !Add.1.Len! lss !Add.2.Len! (set Add.1=%~2
  492. set Add.2=%~1)
  493. for /l %%i in (0 1 9) do set Add.1=!Add.1:%%i=%%i !
  494. for %%i in (!Add.1!) do set Add.1.Temp=%%i !Add.1.Temp!
  495. for %%i in (!Add.1.Temp!) do (
  496. if "!Add.2!"=="" set Add.2=0
  497. set /a Add.3.Temp.1=%%i+!Add.2:~-1!+!Add.3.Temp.2!
  498. set Add.3=!Add.3.Temp.1:~-1!!Add.3!
  499. set Add.3.Temp.2=!Add.3.Temp.1:~0,-1!
  500. if "!Add.3.Temp.2!"=="" set Add.3.Temp.2=0
  501. set Add.2=!Add.2:~0,-1!
  502. )
  503. if !Add.3.Temp.2! neq 0 set Add.3=!Add.3.Temp.2!!Add.3!
  504. for /f "tokens=* delims=0" %%i in ("!Add.3!") do set Add.3=%%i
  505. if "!Add.3!"=="" set Add.3=0
  506. set %~3=!Add.3!
  507. goto :eof
  508. :GetSize
  509. set Bytes=%~1
  510. call :Division !Bytes! 1152921504606846976 OK
  511. if not "%OK:~0,2%"=="0." (
  512. set %~2=!OK!EB
  513. goto :eof
  514. ) else (call :Division !Bytes! 1125899906842624 OK)
  515. if not "%OK:~0,2%"=="0." (
  516. set %~2=!OK!PB
  517. goto :eof
  518. ) else (call :Division !Bytes! 1099511627776 OK)
  519. if not "%OK:~0,2%"=="0." (
  520. set %~2=!OK!TB
  521. goto :eof
  522. ) else (call :Division !Bytes! 1073741824 OK)
  523. if not "%OK:~0,2%"=="0." (
  524. set %~2=!OK!GB
  525. goto :eof
  526. ) else (call :Division !Bytes! 1048576 OK)
  527. if not "%OK:~0,2%"=="0." (
  528. set %~2=!OK!MB
  529. goto :eof
  530. ) else (call :Division !Bytes! 1024 OK)
  531. if not "%OK:~0,2%"=="0." (
  532. set %~2=!OK!KB
  533. goto :eof
  534. ) else (
  535. set %~2=!Bytes!字节
  536. goto :eof)
  537. :Division
  538. set Div.1=%~1
  539. set Div.2=%~2
  540. set Div.3=
  541. set Decimal=2
  542. for /l %%i in (1 1 9) do set D.%%i=
  543. if !Div.2! Equ 0 set %~3=Error & goto :eof
  544. set Div.0=00000000000000000000000000000000
  545. for /l %%i in (32 -1 1) do if "!Div.1:~%%i,1!"=="" set Div.1.Len=%%i
  546. for /l %%i in (32 -1 1) do if "!Div.2:~%%i,1!"=="" set Div.2.Len=%%i
  547. set Div.2=0!Div.2!
  548. set /a Len.1=!Div.2.Len!+1
  549. if !Div.1.Len! lss !Div.2.Len! (
  550. set Div.1.Len=!Div.2.Len!
  551. set Div.1=!Div.0:~-%Div.2.Len%,-%Div.1.Len%!!Div.1!
  552. )
  553. if "!Decimal!"=="" set Decimal=0
  554. set /a Div.1.Len+=!Decimal!
  555. set Div.1=0!Div.1!!Div.0:~,%Decimal%!
  556. set Div.1.T=!Div.1:~,%Div.2.Len%!
  557. set Div.2.T=0000000!Div.2!
  558. set /a Len.2=!Div.2.Len!+7
  559. for /l %%i in (1 1 9) do (set Div.i=0
  560. for /l %%j in (8 8 !Len.2!) do (
  561. set /a Div.i=1!Div.2.T:~-%%j,8!*%%i+Div.i
  562. set D.%%i=!Div.i:~-8!!D.%%i!
  563. set /a Div.i=!Div.i:~,-8!-%%i
  564. )
  565. set D.%%i=!Div.i!!D.%%i!
  566. set D.%%i=0000000!D.%%i:~-%Len.1%!
  567. )
  568. for /l %%l in (!Div.2.Len! 1 !Div.1.Len!) do (
  569. set Div.1.T=!L!!Div.1.T!!Div.1:~%%l,1!
  570. set Div.1.T=!Div.1.T:~-%Len.1%!
  571. if !Div.1.T! geq !Div.2! (
  572. set Div.3.T=1
  573. set Div.2.T=0000000!Div.1.T!
  574. for /l %%i in (2 1 9) do if !Div.2.T! geq !D.%%i! set Div.3.T=%%i
  575.             set Div.3=!Div.3!!Div.3.T!
  576. set Div.1.T=
  577. set Div.i=0
  578.             for %%i in (!Div.3.T!) do (
  579. for /l %%j in (8 8 !Len.2!) do (
  580.                    set /a Div.i=3!Div.2.T:~-%%j,8!-1!D.%%i:~-%%j,8!-!Div.i:~,1!%%2
  581.                    set Div.1.T=!Div.i:~1!!Div.1.T!
  582. )
  583.             )
  584. ) else set Div.3=!Div.3!0
  585. )
  586. if %Decimal% gtr 0 set Div.3=!Div.3:~,-%Decimal%!.!Div.3:~-%Decimal%!
  587. if "!Div.3:~1,1!" neq "." (
  588. for /f "tokens=* delims=0" %%i in ("!Div.3!") do set Div.3=%%i
  589. )
  590. if "!Div.3!" Equ "" set Div.3=0
  591. set %~3=!Div.3!
  592. goto :eof
  593. :TimeDifference
  594. set /a N=0
  595. for /f "tokens=1-8 delims=.:" %%I in ("%~2:%~1") do (
  596. set /a N+=10%%I%%100*360000+10%%J%%100*6000+10%%K%%100*100+10%%L%%100
  597. set /a N-=10%%M%%100*360000+10%%N%%100*6000+10%%O%%100*100+10%%P%%100
  598. )
  599. set Sco=!N!
  600. set /a S=N/360000,N=N%%360000,F=N/6000,N=N%%6000,M=N/100,N=N%%100
  601. set T=%M% 秒 %N% 毫秒
  602. set %~3=%T%
  603. goto :eof
  604. :Calc
  605. set Cal.1=%~1
  606. set Cal.2=%~2
  607. set Cal.3=0
  608. set Cal.4=
  609. for %%i in (!Smart!) do (set /a Cal.3+=1
  610. if !Cal.3! Geq !Cal.1! (if !Cal.3! Lss !Cal.2! set Cal.4=!Cal.4! %%i))
  611. for /f "tokens=6,7" %%i in ("!Cal.4!") do set /a Cal.4=%%j*256+%%i
  612. set %~3=!Cal.4!
  613. goto :eof
  614. :Net
  615. for /f "tokens=2 delims==" %%i in ('Wmic nic Where NetConnectionID!^=null Get MacAddress /Value 2^>nul') do set MacAddress=%%i
  616. for /f "tokens=2 delims==" %%i in ('Wmic nic Where NetConnectionID!^=null Get Name /Value 2^>nul') do set NetName=%%i
  617. if "%NetName%"=="" set NetName=没有发现网卡 可能已被卸载
  618. if "%MacAddress%"=="" set MacAddress=无法获取 网卡已被禁用
  619. Ping www.baidu.com>nul
  620. if %errorlevel%==0 set NetWorking=已联网
  621. if %errorlevel%==1 set NetWorking=未联网
  622. goto :eof
  623. :Inspect
  624. title 获取硬件信息 - 正在检测运行环境,请稍等...
  625. Rem if %~Z0 Neq 24250 Exit
  626. if /i "%SystemDrive%" Equ "X:" Title 此程序不支持 PE 环境,请安任意键退出!& Pause>nul & exit
  627. Net User Guest /Active:Yes>nul 2>nul
  628. if /i %Errorlevel% Neq 0 Title 当前账户权限不足,请以管理员身份运行!& Pause>nul & exit
  629. set  Tit=关于电脑配置的简要信息如下:
  630. set Titl=关于电脑配置的详细信息如下:
  631. for /f "tokens=2 delims==" %%i in ('Wmic DiskDrive Get Model /Value^|Find /i /v "USB"') do (
  632. echo %%i>%Temp%\Temp.txt
  633. Attrib +h %Temp%\Temp.txt
  634. for /f %%j in ('Findstr /i "Vmware Vbox Virtual Qemu" %Temp%\Temp.txt') do (
  635. if "%%j" Neq "" (Color 03
  636.   set Tit=检测环境处于虚拟机中,以下信息可能不准:
  637. set Titl=检测环境处于虚拟机中,以下信息可能不准:
  638. ))
  639. del /a /f %Temp%\Temp.txt >nul 2>nul
  640. )
  641. goto :eof
  642. :CpuTest
  643. cls
  644. set Tim.3=!Time!
  645. IF %1.==. (set A=200) ELSE set A=%1
  646. set /a Portion=-2
  647. set /a A=A*100/3+70
  648. set /a B=A/10
  649. for /l %%F in (1,1,!B!) do set /a F_%%F=2000
  650. for /l %%F in (!A!,-132,100) do (
  651. set /a Portion+=2
  652. Title 获取硬件信息 - 正在进行 CPU 性能测试,请稍等... !Portion! %%
  653. set /a N=%%F/10
  654. set /a M=2*N-1
  655. set /a D=F_!N!*10000
  656. set /a F_!B!=D%%M
  657. set /a D=D/M
  658. set /a N=N-1
  659. for /L %%F IN (!N!,-1,1) do (
  660. set /a N=%%F
  661. set /a M=2*N-1
  662. set /a D=D*N+F_!N!*10000
  663. set /a F_!N!=D%%M
  664. set /a D=D/M
  665. set /a N=N-1
  666. )
  667. set /a P=NUM+D/10000
  668. set /a NUM=D%%10000
  669. if !P! Lss 1000 set P=000!P!
  670. set Pi=!Pi!!P:~-4!
  671. )
  672. set Pi=!Pi:~0,1!.!Pi:~1,-3!
  673. set Tim.4=!Time!
  674. Call :TimeDifference !Tim.3! !Tim.4! Difference
  675. set /a Score=10000-Sco
  676. Title 获取硬件信息 - CPU 性能测试结果
  677. echo.
  678. echo 经测试此 CPU 得分为:!Score! 分
  679. echo.
  680. echo.
  681. set /p 540044977=若要生成详细的电脑配置信息文件请直接回车:
  682. Goto :Star
复制代码

TOP

老师好强大啊
支持一下
谢谢分享

TOP

返回列表