Set /P mubiao=《目标文件夹》
Set /P zdwj=《指定文件》
For /F "Delims=" %%a In ("%zdwj%") Do (
For /F "Delims=" %%b In ('Dir "%mubiao%" /B /S') Do (
Set od=0
Dir "%%b\" /B && For /F "Delims=" %%c In ('Dir "%%b\" /B') Do (
If /I "%%c"=="%%~na%%~xa" Set od=1
)
Dir "%%b\" /B || Set od=1
If "!od!"=="0" Copy "%zdwj%" "%%b\" /Y
)
)
过程大概如上。