- @echo off
- set ph=数据1
- md "数据2" 2>nul
- for /f "delims=" %%f in ('dir /b "%ph%\*.txt"') do (
- setlocal enabledelayedexpansion
- for /f "tokens=1*usebackq" %%a in ("%ph%\%%f") do (
- if defined s1 (
- for %%i in (!s2!) do (
- set /a n+=1
- if "!s1!" equ "%%i" set _!n!=1
- )
- set n=0
- for %%i in (%%a %%b) do (
- set /a n+=1
- if defined _!n! set s=!s! %%i
- )
-
- ) else set s1=%%a&set s2=%%b
- )
- if defined s >"数据2\%%f" echo!s!
- endlocal
- )
- pause
复制代码
|