将以下代码放在该文件夹中运行,完毕后会将合并后的文件输出到该文件夹的copyovertxt子文件夹里!
@echo off
setlocal enabledelayedexpansion
set file1=0
set file2=0
set file3=0
if not exist copyovertxt md copyovertxt
for /f "tokens=*" %%i in ('dir /b *.txt') do (
if !file1!==0 (
set file1=%%~ni
) else (
if !file2!==0 (
set file2=%%~ni
) else (
if !file3!==0 (
set file3=%%~ni
copy "!file1!.txt"+"!file2!.txt"+"!file3!.txt" "copyovertxt\!file1!!file2!!file3!.txt"
set file1=0
set file2=0
set file3=0
)
)
)
)
pause