@echo off
setlocal
set "sourceFolder=(源文件夹)"
set "destinationFolder=(目标文件夹)"
set "fileList=(关键字 多个关键字使用空格隔开)"
if not exist "%destinationFolder%" mkdir "%destinationFolder%"
for %%F in (%fileList%) do (
(复制copy 移动move) "%sourceFolder%\*%%F*" "%destinationFolder%\"
)
echo Files copied successfully!
endlocal
@echo off
setlocal
set "sourceFolder=F:\x\demo\1\allfile"
set "destinationFolder=F:\x\demo\2\newfile"
set "fileList=YX100042200 YX200000056 YX200001565 YX200565463"
if not exist "%destinationFolder%" mkdir "%destinationFolder%"
for %%F in (%fileList%) do (
copy "%sourceFolder%\*%%F*" "%destinationFolder%\"
)
echo Files copied successfully!
endlocal