Okay. I got rid of most of the useless code and have been tinkering with it here and there trying to find what is the problem and I think I finally found it:
Windows' Batch can't edit variables that will be expanded if those are inside a FOR
loop.
Ex:
set /a x=1
Powershell Get-Clipboard> %temp%\ffmpeglist.txt
setlocal enableExtensions enableDelayedExpansion
for /F "delims=| tokens=*" %%A in (%temp%\ffmpeglist.txt) do (
set input[!x!]=%%A
call echo !input[%x%]!
set /a x += 1
)
endlocal
Expected behavior:
g:\videos\youtube1.mp4
g:\videos\youtube2.mp4
g:\videos\youtube3.mp4
g:\videos\youtube4.mp4
g:\videos\youtube5.mp4
What I get:
g:\videos\youtube1.mp4
g:\videos\youtube1.mp4
g:\videos\youtube1.mp4
g:\videos\youtube1.mp4
g:\videos\youtube1.mp4
No matter what I do, set /a x+= 1
will not change the value of x
.
Are there solutions? I'm open to anything.