@echo off
chcp 936 >nul 2>nul
sc config winmgmt start= auto >nul 2>nul
net start winmgmt >nul 2>nul
color 0a
echo 计算机名:
hostname
echo.
set URL=www.163.com
echo 电脑品牌是:
wmic csproduct get Vendor |findstr -v Vendor
echo 电脑型号是:
wmic csproduct get Name,version |findstr -v Name |findstr -v Version
echo 电脑序列号是:
rem wmic csproduct get IdentifyingNumber
wmic bios get serialnumber |findstr -v SerialNumber
echo CPU型号是:
wmic cpu get name |findstr -v Name
systeminfo | findstr -i 物理内存总量
echo.
echo 硬盘型号是:
wmic diskdrive get model |findstr -v Model
echo.
echo.
echo.
echo —===以下为网卡信息===—
rem for /f “tokens=4” %%a in (‘route print^|findstr 0.0.0.0.*0.0.0.0’) do (set IP=%%a)
for /f “tokens=16 delims= ” %%a in (‘ipconfig ^| find /i “IPv4″‘) do (set IP=%%a)
for /f “tokens=3” %%b in (‘route print^|findstr 0.0.0.0.*0.0.0.0’) do (set GW=%%b)
rem for /f “tokens=15 delims= ” %%b in (‘ipconfig /all ^| find /i “网关”‘) do (set GW=%%b)
for /f “tokens=15 delims= ” %%c in (‘ipconfig /all ^| find /i “掩码”‘) do (set SUB=%%c)
rem for /f “tokens=2 delims= ” %%c in (‘route print^|findstr /v 127.0.0.1^|findstr %IP%^|findstr /v 0.0.0.0^|findstr /v 240.0.0.0^|findstr /v 255.255.255.255’) do (set SUB=%%c)
for /f “tokens=15 delims= ” %%d in (‘ipconfig /all ^| find /i “dns”‘) do (set NS=%%d)
for /f “tokens=1 delims= ” %%e in (‘getmac /nh’) do (set MAC=%%e)
for /f “tokens=3* delims= ” %%f in (‘netsh interface show interface ^| findstr 已连接’) do (set card=%%g)
echo 接网线的网卡名是:
echo %card%
echo.
echo 局域网IP是:
echo %IP%
echo.
echo 网卡MAC是:
echo %MAC%
echo.
echo 子网掩码是:
echo %SUB%
echo.
echo 局域网网关是:
echo %GW%
echo.
rem echo 首选DNS是:
rem echo %NS%
echo 域名解析设置:
netsh interface ip show dnsservers|findstr “[0-9]*\.[0-9]*\.”
echo.
echo.
echo.
echo —===以下为网络连通性测试结果===—
echo.
ping %GW% -n 2 > nul
if %errorlevel% leq 0 (
echo 网关%GW%链接正常。
) else (
echo 网关%GW%访问异常,请检查IP和子网掩码或网关设置。
)
echo.
ping %URL% -n 2 > nul
if %errorlevel% leq 0 (
echo 网址%URL%访问正常。
) else (
echo 网址%URL%访问异常,请检查DNS设置。
)
echo.
echo.
echo.
echo 已检测完毕,按任意键关闭窗口。
pause>nul