批处理文件!!急急急!!高手速进来看看··##
来源:百度知道 编辑:UC知道 时间:2024/05/18 09:54:00
我想做一个这样的批处理!
首先运行cmd
输入ipconfig/all
停留。。。
按任意键关闭cmd
就是要查本机IP~
在线等~!!!!
首先运行cmd
输入ipconfig/all
停留。。。
按任意键关闭cmd
就是要查本机IP~
在线等~!!!!
ipconfig
echo. & pause
将上面的文字拷贝至记事本,保存为“*.bat”就可以了
@echo off
::调用格式:
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