- 帖子
- 643
- 积分
- 1270
- 技术
- 1
- 捐助
- 0
- 注册时间
- 2012-7-1
|
3楼
发表于 2014-4-5 23:29
| 只看该作者
@echo off
set "SrcDir1=C:\abc\New"
set "SrcDir2=D:\123\New"
set "DstDir=%~dp0合并"
xcopy "%SrcDir1%\*.txt" "%DstDir%\" /sy >nul
for /r "%DstDir%\" %%a in (*.txt) do (
set "a=%%a"
setlocal enabledelayedexpansion
set "b=!a:%DstDir%=%SrcDir2%!"
if exist "!b!" copy /b "!a!" + "!b!" "!a!"
endlocal
)
pause |
|