- @echo off
- SetLocal EnableDelayedExpansion
- for /f "delims=" %%a in (123.txt) do (
- set /a n+=1
- set .!n!=%%a
- )
- md temp
- for %%i in (*.txt) do (
- if not "%%i"=="123.txt" (
- SetLocal
- for /f "usebackq" %%a in ("%%i") do set /a m+=1
- set /a lines = !random! %% 3 + 3
- for /l %%a in (1 1 !lines!) do (
- set /a line = !random! %% m + 1
- set #!line!#=:D
- )
- for /f "usebackq delims=" %%j in ("%%i") do (
- set /a h+=1
- if defined #!h!# (
- set /a .n_n = !random! %% n + 1
- for %%b in (!.n_n!) do echo !.%%b!
- )
- echo,%%j
- )
- EndLocal
- ) > "temp\%%i"
- )
复制代码
|