title: How to count no of lines in text file and store the value into a variable using batch script?
body: <p>I want to count the no of lines in a text file and then the value has to be stored into a environment variable. The command to count the no of lines is</p>
  
  <pre>
  findstr /R /N "^" file.txt | find /C ":"
  </pre>
  
  <p>I refered the question <a href="https://stackoverflow.com/questions/1427218">How to store the result of a command expression in a variable using bat scripts?</a> 
  Then I tried,</p>
  
  <pre>
  set cmd="findstr /R /N "^" file.txt | find /C ":" "
  </pre>
  
  <p>I am getting the error message,</p>
  
  <pre>
  FIND: Parameter format not correct
  </pre>
  
  <p>How could i get rid of this error. </p>