title: delim command only reading parts of a txt file
body: <p>I'm a newbie to programming.</p>
  
  <p>I have a txt fileA containing the list of files within a directory.</p>
  
  <p>Scenario:
  I'm running the delim command to remove new line special character codes and replace with commas from the list of jpg file names (cicra 10000) in the txt fileA and output the result to output fileB.</p>
  
  <p>Problem:
  Only a random amount of file names reach the output file! Some or many are missing.</p>
  
  <p>Here's the code...</p>
  
  <p>========================================</p>
  
  <pre><code>dir /o /b &gt; fileA.txt
  set "txt="
  for /f "delims=" %%a in (fileA.txt) do (
    set "txt=!txt!%%a,"
  )
  set "txt=!txt:~0,-1!"
  &gt;fileB.txt echo !txt!
  </code></pre>
  
  <p>=========================================</p>
  
  <p>Any help appreciated :)
  Thank you</p>