显示网络配置的批处理文件
时间:2021-04-06 10:03:08|栏目:DOS/BAT|点击: 次
显示网络配置.bat
@echo off
:: 代码编写:3742668 代码修订:namejm www.cn-dos.net
::调用格式:
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"
goto :eof
复制代码 代码如下:
@echo off
:: 代码编写:3742668 代码修订:namejm www.cn-dos.net
::调用格式:
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"
goto :eof
上一篇:BAT加密工具 EncryBat 非编译型bat批处理加密方案与代码
栏 目:DOS/BAT
下一篇:BAT批处理之文件与文件夹操作代码(附xcopy命令详解)
本文标题:显示网络配置的批处理文件
本文地址:http://www.codeinn.net/misctech/95836.html