304802301 当前离线
一级士官
评分人数
77七 当前离线
中校
@echo off rem 先设置路径,需要引号,如 set 清单="D:\清单.txt" set 源文件夹= set 清单= cd /d %源文件夹% for /f "delims=" %%a in ('type %清单%') do ( set n= for /f "delims=" %%b in ('dir /b /s /a-d *.txt') do ( for /f "delims=" %%c in ('type "%%~fb" ^| find "%%a"') do ( echo %%a %%c %%~fb set n=1 ) ) if not defined n ( echo %%a 未搜索到 ) )>>"%~dp0"结果.txt pause复制代码
TOP
terse 当前离线
中将
@echo off set "源文件夹=%~dp0源文件夹" set "清单=清单.txt" (for /f "delims=" %%i in (清单.txt) do ( (for /f "tokens=1,2*delims=:" %%a in ('findstr /is "%%i" "%源文件夹%\*.txt"') do ( echo %%i %%c %%a:%%b ))||echo %%i 未搜索到 ))>结果.txt pause复制代码
这样效率高点 terse 发表于 2023-1-30 15:59