@echo off
Title 显示网络配置
color 1f
::调用格式:
call :select "ip address" "ip"
call :select "Physical Address" "mac"
call :select "Default Gateway" "gateway"
call :select "DNS Servers" "dns"
call :select "Description" "netcard"
:: 演示效果
echo IP:%ip%
echo MAC:%mac%
echo DNS:%dns%
echo GATEWAY:%gateway%
echo NETCARD:%netcard%
pause>nul
goto :eof
::**************************************************************
:: 解析ipconfig命令输出通用函数
::**************************************************************
:select
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!"=="" set "%~2=%%i"
:eof
××××××××××××
in ('ipconfig /all ^| findstr /i /c:%1')其中的^| 正常应该仅有|,这是???
为何最后这一点set "%~2=%%i"使用了%~2而不是%2呢???
[ Last edited by zhclvip on 2007-2-1 at 10:38 AM ]
Title 显示网络配置
color 1f
::调用格式:
call :select "ip address" "ip"
call :select "Physical Address" "mac"
call :select "Default Gateway" "gateway"
call :select "DNS Servers" "dns"
call :select "Description" "netcard"
:: 演示效果
echo IP:%ip%
echo MAC:%mac%
echo DNS:%dns%
echo GATEWAY:%gateway%
echo NETCARD:%netcard%
pause>nul
goto :eof
::**************************************************************
:: 解析ipconfig命令输出通用函数
::**************************************************************
:select
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!"=="" set "%~2=%%i"
:eof
××××××××××××
in ('ipconfig /all ^| findstr /i /c:%1')其中的^| 正常应该仅有|,这是???
为何最后这一点set "%~2=%%i"使用了%~2而不是%2呢???
[ Last edited by zhclvip on 2007-2-1 at 10:38 AM ]
