- @echo off
- set /p words=input the word you want to find in files:
- set /p files=input the range you want to define:
- if "%files:~-4%"==".txt" findstr /n /c:"%words%" "%files%"&pause>nul&goto :eof
- for /f "delims=" %%a in ('dir /s /b %files%\*.txt') do (
- findstr /n /c:"%words%" "%%a">tmps.txt && echo %%a
- for /f "tokens=1,2 delims=:" %%b in (tmps.txt) do echo %%c line:%%b
- )
- del tmps.txt /q 2>nul
- pause>nul
复制代码
|