批处理tokens,求大神(win7系统写了批处理来提取MAC地址)
发布网友
发布时间:2022-04-25 20:05
我来回答
共2个回答
热心网友
时间:2022-06-17 00:44
@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
:: 中国批处理脚本联盟
热心网友
时间:2022-06-17 00:44
@echo off
CALL :Getmac
rem SET "Mac=%Mac:-=%"
echo 本机MAC地址:%Mac%
PAUSE
Exit
:Getmac
for /f "skip=3 tokens=1 delims= " %%i in ('getmac') do set "Mac=%%i"& goto :eof
goto :eof