I'm trying to do some scripting and I'm stack with this.
I have a file called "songs.txt" that it has 14 lines with some text. I'm filtering each line by some criteria and put every line filtered inside an array.
The problem is when I try to iterate a value of an array inside the for loop. This is my code:
setlocal EnableDelayedExpansion
set i=1
for /F %%a in (songs.txt) do (
set elem[!i!]=%%a
set /A i+=1
)
set x=1
:: nsongs is the length of the lines inside of hte file songs.txt
for /L %%b in (1,1,%nsongs%) do (
echo START Track %%b: !elem[%%b]!
:: Now, the problem, this echo END Track... is not showing the array value at position %x%
echo END Track %%b: !elem[%x%]!
set /A x+=1
echo --------------------------
)
endlocal
Any thoughts?
Thank you.