@echo off&setlocal enabledelayedexpansion
set a=d:\a\
set b=d:\b.csv
set c=d:\c\
for /f "delims=" %%i in ('dir/b !a!') do (
(type !b! | find /i "%%i") && copy "!a!%%i" "!c!"
)
pause
6/23/2021,Wednesday,New Bitmap Image.bmp,9:00-18:00,8,200
The system cannot find the file specified.
6/24/2021,Thursday,New Microsoft Excel Worksheet.xlsx,9:00-18:00,8,200
The system cannot find the file specified.
6/25/2021,Friday,New Microsoft Publisher Document.pub,9:00-18:00,8,200
The system cannot find the file specified.
7/1/2021,Thursday,New Text Document (2).txt,9:00-18:00,8,200
The system cannot find the file specified.
7/2/2021,Friday,New Text Document.txt,9:00-18:00,8,200
The system cannot find the file specified.
Press any key to continue . . .
@echo off&setlocal enabledelayedexpansion
set a=d:\a\
set b=d:\b.csv
set c=d:\c\
for /f "delims=" %%i in ('dir/b/s !a!') do (
find /i "%%~nxi" %b% >nul && copy "%%i" "!c!" >nul || set /p=""没有找到文件%%i"," <nul
)
pause