title: Windows command working in cmd but not in .bat file
body: <p>Hello i am trying create windows script for extract subtitles from all .mkv files in directory and i run to problem.</p>
  
  <p>This is my script:</p>
  
  
  
  <pre><code>dir /b | findstr .*".mkv"$ &gt; tmpFile
  for /f "tokens=*" %f in (tmpFile) do start mkvextract.exe tracks %f 2:%~nf.ass
  del tmpFile
  </code></pre>
  
  
  
  <p>Problem is that when i am executing it in cmd.exe everything works OK, but when i wrap it in .bat file only first and third line can be executed.</p>
  
  <p>for line saying this error </p>
  
  <pre><code>C:\test&gt;dir /b   | findstr .*".mkv"$  1&gt;tmpFile
  The following usage of the path operator in batch-parameter
  substitution is invalid: %~nf.ass
  
  For valid formats type CALL /? or FOR /?
  The syntax of the command is incorrect.
  
  C:\test&gt;for /f "tokens=*" f 2:n (tmpFile) do start
  mkvextract.exe tracks %f 2:%~nf.ass
  </code></pre>
  
  
  
  <p>I was trying alter script to fix error but only thing i achieved was that is stopped working even in command line. Please help. :)</p>