@echo off
set tempsys=%1
if %1*==* SET TEMPSYS=C:\windows\system32\config\SYSTEM
REG LOAD HKLM\TEMPSYS %tempsys%
set regx=HKLM\TEMPSYS\ControlSet001
echo 显示本地网标 >%temp%\temp.txt
for /f "tokens=3" %%c in ('reg query %regx%\Control\ComputerName\ComputerName ^| find /i "computername"') do echo %%c >>%temp%\temp.txt
echo.>>%temp%\temp.txt
echo 显示本地固定ip>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
for /f "tokens=3" %%d in ('reg query %%c /v ipaddress^|find /i "ipaddress"') do if not %%d*==0.0.0.0\0\0* echo %%d>>%temp%\temp.txt
)
echo.>>%temp%\temp.txt
echo 显示本地子网掩码>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
for /f "tokens=3" %%d in ('reg query %%c /v subnetmask^|find /i "subnetmask"') do if not %%d*==0.0.0.0\0\0* echo %%d>>%temp%\temp.txt
)
echo.>>%temp%\temp.txt
echo 显示本地默认网关>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
for /f "tokens=3" %%d in ('reg query %%c /v defaultgateway^|find /i "defaultgateway"') do if not %%d*==\0* echo %%d>>%temp%\temp.txt
)
echo 显示本地固定dns>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
for /f "tokens=3" %%d in ('reg query %%c /v nameserver^|find /i "nameserver"') do echo %%d>>%temp%\temp.txt
)
echo.>>%temp%\temp.txt
REG UNLOAD HKLM\TEMPSYS
cls
type %temp%\temp.txt
echo.
pause