本帖最后由 apang 于 2012-10-12 13:37 编辑
要修改的文档在"d:\a"文件夹里,开头.txt和结尾.txt放在桌面上,将代码保存到桌面上:- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (开头.txt) do set /a m+=1&set ".!m!=%%a"
- for /f "delims=" %%a in (结尾.txt) do set /a n+=1&set "_!n!=%%a"
- pushd "d:\a\"
- for /f "delims=" %%a in ('dir /a-d /b *.txt') do (
- set /a r1=1+!random! %% m
- set /a r2=1+!random! %% n
- (for %%b in (!r1!) do echo,!.%%b!
- for /f "usebackq delims=" %%b in ("%%a") do echo,%%b
- for %%b in (!r2!) do echo,!_%%b!)>$
- move $ "%%a"
- )
复制代码
|