title: Powershell - How to display next $line in a foreach loop
body: <p>I am currently parsing strings from .cpp files and need a way to display string blocks of multiple lines using the _T syntax. To exclude one line _T strings, I included a -notmatch ";" parameter to exclude them. This also excludes the last line of the string block, which I need. So I need to display the next string, so that the last string block with ";" is included.</p>
  
  <p>I tried $foreach.moveNext() | out-file C:/T_Strings.txt -append but no luck.</p>
  
  <p>Any help would be greatly appreciated. :)</p>
  
  <pre><code>    foreach ($line in $allLines)
  
      {
  
      $lineNumber++
  
      if ($line -match "^([0-9\s\._\)\(]+$_=&lt;&gt;%#);" -or $line -like "*#*" -or $line -like "*\\*" -or $line -like "*//*" -or $line -like "*.dll* *.exe*")
      {
          continue
      } 
  
      if ($line -notlike "*;*" -and $line -match "_T\(\""" ) # Multiple line strings
      {
          $line | out-file C:/T_Strings.txt -append
          $foreach.moveNext() | out-file C:/T_Strings.txt -append
      }
  </code></pre>