title: Count lines in file and store in Variable
body: <p>I need to count the number of lines in a text file and use this as my loop variable for my <code>for</code> loop. Problem being this:</p>
  
  <pre><code>$lines = Get-Content -Path PostBackupCheck-Textfile.txt  | Measure-Object -Line
  </code></pre>
  
  <p>Although this does return the number of lines, it returns it in a state that cannot be compared to an integer in my loop:</p>
  
  <pre><code>for ($i=0; $i -le $lines; $i++)
      {Write-Host "Line"}
  </code></pre>