i want batch file to search in txt file for string and get full line of it
this is the txt file input
1:how are you
3:im fine
2:yeah
for example
@echo off
set string=3:
echo the full line off the string is %fullline%
pause
here is a batch file that calls findstr directly, and within a for loop to add text to the line. if you just want the found text delete the line beginning with for.
@echo off
set findtext="blah"
set findfile="test.txt"
findstr %findtext% %findfile%
for /f "delims=" %%a in ('findstr %findtext% %findfile%') do echo The full line of the string is %%a
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.