nihaoareyou 当前离线
列兵
mms0536 当前离线
上等兵
TOP
DAIC 当前离线
中将
findstr /m "姓名" *.txt复制代码
@echo off&setlocal EnableDelayedExpansion set i=0 for /f "delims=""" %%a in ('findstr /m /c:"姓名" "txt所在路径\*.txt"') do ( set /a i+=1 copy %%a d:\include_name\*.* cls echo 已复制 !i!个文件 . ) setlocal DisableDelayedExpansion echo 执行完毕 pause >nul复制代码
@echo off for /f "delims=""" %%a in ('findstr /m /c:"姓名" "txt所在路径\*.txt"') do ( copy %%a d:\include_name\*.* ) echo 执行完毕 pause >nul复制代码
tmplinshi 当前离线
版主
findstr /m /c:"姓名" *.txt复制代码
@echo off if not exist d:\include_name mkdir d:\include_name setlocal EnableDelayedExpansion for /r "路径" %%a in (*.txt) do ( find "姓名" %%a if "!errorlevel!"=="0" copy %%a d:\include_name\*.* /y ) setlocal DiskableDelayedExpansion echo 已完成,保存在d:\include_name\ pause >nul复制代码
@echo off setlocal EnableDelayedExpansion for /r "路径" %%a in (*.txt) do ( find "姓名" %%a if "!errorlevel!"=="0" echo %%a >>d:\include_name.txt ) setlocal DiskableDelayedExpansion echo 已完成,路径保存在d:\include_name.txt pause >nul复制代码