I want to pass the very first file returned by
dir *.png /B
into the variable %firstFile%
Why do you need dir?
for %%x in (*.png) do if not defined firstFile set "firstFile=%%x"
                        why do you need to iterate over all of the list?
for  %%x in (*.*) do (
  set "firstFile=%%x"
  goto :done
)
:done 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With