不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件及文件夹放一起双击运行
echo off&cls
rem 将当前目录里的多个文件跟一个指定文件夹里的文件分别进行合并后删除
mode con lines=3000
set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
cd /d "%~dp0"
set "folder1=.\A"
set "folder2=.\B"
if not exist "%folder1%" (echo;"%folder1%" not found&pause&exit)
if not exist "%folder2%" (md "%folder2%")
for /f "delims=" %%a in ('dir /a-d-h/b') do (
if /i "%%~nxa" neq "%~nx0" (
for /f "delims=" %%b in ('dir /a-d-h/b "%folder1%\"') do (
copy /b "%%a"+"%folder1%\%%b" "%folder2%\%%~nxa"
)
del /q /f /q "%%a"
)
)
echo;%#% +%$%%$%/%_% %z%
pause
exit
echo off&cls
rem 将当前目录里的多个文件跟一个指定文件夹里的文件分别进行合并后删除
mode con lines=3000
set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
cd /d "%~dp0"
set "folder1=.\A"
set "folder2=.\B"
if not exist "%folder1%" (echo;"%folder1%" not found&pause&exit)
if not exist "%folder2%" (md "%folder2%")
for /f "delims=" %%a in ('dir /a-d-h/b') do (
if /i "%%~nxa" neq "%~nx0" (
for /f "delims=" %%b in ('dir /a-d-h/b "%folder1%\"') do (
copy /b "%%a"+"%folder1%\%%b" "%folder2%\%%~nxa"
)
del /q /f /q "%%a"
)
)
echo;%#% +%$%%$%/%_% %z%
pause
exit