CODE: [Copy to clipboard]
@echo off
echo 自动搜索 by judas
title 文件搜索
color 1f
:loop
echo.
for /f "delims=" %%a in (search.txt) do (
set filename=%%a
more +1 search.txt > search_tmp.txt
move /y search_tmp.txt search.txt
echo %%a >> done.log
goto show
)
:show
echo 搜索值为:
echo.
echo %filename%
if "%filename%"=="end" goto end
echo.
goto search
echo.
:search
echo 文件搜索中,请耐心等待...
findstr /i /c:"%filename%" dir.txt>>temp.txt
type temp.txt
for /f "tokens=*" %%b in (temp.txt) do echo "%%b">>results.txt
echo 搜索完毕
del temp.txt
echo.
echo.
echo continue...
echo %filename%
echo.
echo.======================================
goto loop
pause>nul
:end
pause
exit
搜索完的关键字被转移到了一个叫done.log的日志文件中,搜索的结果保存在results.txt中