title: Executing all text files in one folder by a batch script
body: <p>How do I use all the .txt files in a particular folder as input into my batchscript, without having to hardcode their names individually?</p>
  
  <p>In short: I want the batch script to process all the .txt files in the directory it resides in.</p>
  
  <p>Current code:</p>
  
  <pre><code>for /f "tokens=4 delims=|" %%a in (filename1.txt) do (...)
  </code></pre>
  
  <p>...which reads only one.</p>
  
  <p>I've tried the following methods that do not work:</p>
  
  <pre><code>for /f "tokens=4 delims=|" %%a in ('dir /b C:\BatchScripting') do (..)
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>for /f "tokens=4 delims=|" %%a in (*.txt) do (...)
  </code></pre>
  
  <p>And this too:</p>
  
  <pre><code>for /f "tokens=4 delims=|" %%a in (%%~dpnx) do (...)
  </code></pre>
  
  <p>But to no avail. Help!</p>