批处理tokens,求大神(win7系统写了批处理来提取MAC地址)
@echoofffor/f"tokens=2delims=:"%%iin('ipconfig/all^|findstr/i/c:"IPv4地址"')do(seta=IP:...
@echo off
for /f "tokens=2 delims=:" %%i in ('ipconfig /all^|findstr /i /c:"IPv4 地址"') do (set a=IP:%%i)
for /f "tokens=2 delims=:" %%i in ('ipconfig /all^|findstr /i /c:"物理地址"') do (set b=mac:%%i)
set/p c=请输入公司名称:
set/p d=请输入部门:
set/p e=请输入姓名:
echo %a% >b.txt
echo %b% >>b.txt
echo %c% >>b.txt
echo %d% >>b.txt
echo %e% >>b.txt
start "" b.txt
机器有好几块网卡,我想提取有线网卡的MAC地址,求大神帮忙看看 展开
for /f "tokens=2 delims=:" %%i in ('ipconfig /all^|findstr /i /c:"IPv4 地址"') do (set a=IP:%%i)
for /f "tokens=2 delims=:" %%i in ('ipconfig /all^|findstr /i /c:"物理地址"') do (set b=mac:%%i)
set/p c=请输入公司名称:
set/p d=请输入部门:
set/p e=请输入姓名:
echo %a% >b.txt
echo %b% >>b.txt
echo %c% >>b.txt
echo %d% >>b.txt
echo %e% >>b.txt
start "" b.txt
机器有好几块网卡,我想提取有线网卡的MAC地址,求大神帮忙看看 展开
2个回答
展开全部
@echo off & color 0e
set/p a=请输入公司名称:
set/p b=请输入部门:
set/p c=请输入姓名:
echo %a% >b.txt
echo %b% >大肆>键颤b.txt
echo %c% >>b.txt
ipconfig -all>ip.txt
for /f "delims=" %%a in (ip.txt) do (
for /f "tokens=1* delims=:" %%i in ('call echo 稿仿败%%a^|find /i "IPv4 地址"') do Echo %%a>>"b.txt"
)
for /f "delims=" %%a in (ip.txt) do (
for /f "tokens=1* delims=:" %%i in ('call echo %%a^|find /i "物理地址"') do Echo %%a>>"b.txt"
)
del /s /q "ip.txt" & start "" "b.txt" & exit
:: 中国批处理脚本联盟
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询