title: Batch - find a string in first 10 characters on line and print whole line
body: <p>I am having trouble with findstr command.
  I am using batch file to execute a proccess that will search all .txt in folder and print out lines that have a string in first 10 characters that is previously defined.
  So far I have been using this batch:
      <pre>for /f "delims=" %%I in ('dir/B *.txt') do (
      for /f "delims=" %%J in (%%I) do (
          set "<em>=%%J"
          call echo %%</em>:~0,10%%|findstr "R0621 32411"&amp;&amp;call echo %%_%% >> search.txt
      ) 
  )
  endlocal    </pre>
  Somehow this batch however does not print out lines that consists strings like R0621 or 32411. Is this a bug?
  When I try the typical findstr batch it works and prints out lines just fine. For example this:
      <pre>
  findstr "R0621 32411" *.txt >> search.txt
      </pre>
  .txt files that this batch searches through looks like this:
      <pre>
  AA32411   AAA RANDOMTEXTANDNUMBERS 13121313212153
  BBR0621   BBB RANDOMTEXTANDNUMBERS 78975487798797
  CCY4488   CCC RANDOMTEXTANDNUMBERS 44455577799998
      </pre>
  I cant use the findstr because it finds string after 10 characters and those lines i dont need (i need only those that have strings i define in first 10 chars per line).</p>
  
  <p>Is there any alternative? I tried to search internet but couldnt find any help anywhere.
  Also for better understanding you can check my previous thread <a href="https://stackoverflow.com/questions/18823489/batch-to-find-a-string-of-numberletter-combination-only-in-first-10-characters">Batch to find a string of number&amp;letter combination only in first 10 characters (in a txt file) per row and print the whole row</a></p>