具体代码如下,只需要另存为check.bat即可。
@echo off
call :Inspect
title 获取硬件信息 – 正在获取相关信息,请稍等…
call :Net
Setlocal EnableDelayedExpansion
echo !Tit!
echo …………………………………………………….
echo.
if not exist “%Temp%\DxDiag.txt” DxDiag /t %Temp%\DxDiag.txt
:DxDiag
if exist “%Temp%\DxDiag.txt” (
Attrib +h %Temp%\DxDiag.txt
Ping 127.1 >nul
for /f “tokens=2 delims=:” %%i in (‘FINDSTR /IC:”Operating System: ” %Temp%\DxDiag.txt’) do (
for /f “delims=(” %%j in (“%%i”) do set OS=%%j
)
) else (ping 127.1 >nul
goto :DxDiag
)
title 获取硬件信息 – %OS%