本帖最后由 qixiaobin0715 于 2024-11-8 09:08 编辑
替换:- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=1,2 delims=," %%i in (a.txt) do set _%%i=%%j
- for /f "tokens=1* delims=_" %%i in (b.txt) do (
- if "%%j"=="" (set str=%%i) else set "str=%%i_%%j"
- for /f "tokens=2 delims== " %%k in ("%%j") do (
- for %%l in (!_%%k!) do set str=!str:%%k=%%l!
- )
- echo,!str!
- )
- pause
复制代码 顺序输出MAC的值:- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=2 delims=_" %%i in (b.txt) do (
- for /f "tokens=2,4 delims== " %%j in ("%%i") do (
- for /f "tokens=1-4 delims=." %%a in ("%%j") do (
- set a1=00%%a
- set a2=00%%b
- set a3=00%%c
- set a4=00%%d
- set _!a1:~-3!!a2:~-3!!a3:~-3!!a4:~-3!=%%k
- )
- )
- )
- for /f "tokens=2 delims==" %%i in ('set _^|sort /r') do echo,%%i
- pause
复制代码
|