title: Windows batch file extract number from filename
body: <p>I have written a <code>for</code> loop in a Win7 batch file which runs through every file in a specified folder: </p>
  
  <pre><code>for /f %%f in ('dir /b C:\some_folder') do ( 
      echo %%f
  )
  </code></pre>
  
  <p>The files are in this format <code>abc_123_1234567.txt</code>. How can I extract the last set of numbers (i.e. <code>1234567</code>) from the filename and put them in a variable? </p>