- @echo off
- SetLocal EnableDelayedExpansion
-
- set "S=D:\A"
- set "S_R=D:\B"
- set "D=D:\C"
-
- set n=
- for %%a in ("%S_R%\*.txt") do (
- set /a n += 1
- set !n!=%%~na
- )
-
- cd /d "%S%"
- md "%D%" 2>nul
- for %%i in (*.txt) do (
- set /a r1 = !random! %% n + 1, r2 = !random! %% n + 1
- for /f "tokens=1,2" %%a in ("!r1! !r2!") do (
- copy "%S_R%\!%%a!.txt"+"%%i"+"%S_R%\!%%b!.txt" "%D%\%%~nxi" /b
- )
- )
复制代码
|