I want to copy to a new single file (Ebinds.txt) a certain value from a number of "identical" .txt files found in a folder. the files are named such as log1.txt, log2.txt, etc. and the value I am interested in is always placed in the same spot aka 22nd line, 2nd value. the part where I search for my value and copy it works fine. my problem is when I try to loop through all the files in the folder ( all I get is echo off instead of the values)
below is an example of the code I got so far when there are 4 files in my folder.
@echo off
FOR /l %%P IN (1,1,4) DO (
set InFile=C:\Users\nuca\Desktop\dock_copy_Ebind\nodV_log%%P.txt
set /a "line = 0"
for /f "tokens=2 delims= " %%L in ("%InFile%") do (set /a "line = line + 1"
if !line!==22 set thing=%%L
)
endlocal && set thing=%thing%
echo %thing% >>C:\Users\nuca\Desktop\dock_copy_Ebind\Ebinds.txt
)