First off, I'm new to batch files.
I want to find all files with extension .txt
in a folder and then scan them so that it scans the 5th line of the text file which is in the format:
txt||||open.doc|||
It then fetches this doc file and gives it as output
This is the code I am using:
@echo off
for %%f in (*.txt) do (
if "%%~xf"==".txt" do (
for /f "tokens=1* delims=:img|||" %%a in ('findstr /n .* %%f') do (
if "%%a" equ "4" (
echo.%%b
set str=%%b
set str=%str:~1,-1%
echo str: %str%
)
)
)
)
pause