::==================批处理获取本机IP(局域网)及MAC地址==============
::code by youxi01@bbs.bathome.cn 2008-1-5
@echo off
setlocal enabledelayedexpansion
title 获取本机IP(局域网)及MAC地址@bbs.bathome.cn
Rem '/*=========初始化设置=============*/
set "Space= "
set "PH_addr=%Space%Physical Address" %'/*-----物理地址-------*/%
set "IP_addr=%Space%IP Address" %'/*------IP地址(局域网)--------*/%
Rem ===========主程序===================
for /f "tokens=1,* delims=." %%i in ('ipconfig /all') do (
for %%a in (PH_addr IP_addr) do (
if "%%i"=="!%%a!" set %%a=%%j
)
)
Rem '/*===========对结果进行处理===========
set PH_addr=%PH_addr:*:=%
set IP_addr=%IP_addr:*:=%
Rem '/*===========结果输出===============
echo.
echo 你的网卡物理地址为:%PH_addr%
echo.
echo 你的IP(局域网)地址为:%IP_addr%
pause>nul
::code by youxi01@bbs.bathome.cn 2008-1-5
@echo off
setlocal enabledelayedexpansion
title 获取本机IP(局域网)及MAC地址@bbs.bathome.cn
Rem '/*=========初始化设置=============*/
set "Space= "
set "PH_addr=%Space%Physical Address" %'/*-----物理地址-------*/%
set "IP_addr=%Space%IP Address" %'/*------IP地址(局域网)--------*/%
Rem ===========主程序===================
for /f "tokens=1,* delims=." %%i in ('ipconfig /all') do (
for %%a in (PH_addr IP_addr) do (
if "%%i"=="!%%a!" set %%a=%%j
)
)
Rem '/*===========对结果进行处理===========
set PH_addr=%PH_addr:*:=%
set IP_addr=%IP_addr:*:=%
Rem '/*===========结果输出===============
echo.
echo 你的网卡物理地址为:%PH_addr%
echo.
echo 你的IP(局域网)地址为:%IP_addr%
pause>nul
@echo off
for /f "delims=" %%i in ('ipconfig^|find "IP Address"')do echo %%i> tmpip.txt
for /f "delims=" %%i in ('ipconfig^|find "IP Address"')do echo %%i> tmpip.txt