本帖最后由 keiamy 于 2014-1-26 17:40 编辑
自己不怎么会做,都是参照楼上各高手的- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=1,2" %%i in (a.txt) do (
- set "$%%i=%%i#%%j"
- set "@%%j=%%i#%%j"
- if defined @%%i (call set "str=%%str:!@%%i!=!$%%i! !@%%i!%%"
- ) else (
- if defined $%%j (call set "str=%%str:!$%%j!=!$%%j! !@%%j!%%"
- ) else (
- set "str=!str! !$%%i!")))
- for %%i in (%str%) do (set "var=%%i"&echo !var:#= !)
- pause
复制代码
|