title: how do I loop through a line from a csv file in powershell
body: <p>I want to process a csv file in powershell, but I don't know what the column headings in the CSV file will be when it is processed. </p>
  
  <p>For example:</p>
  
  <pre><code>$path = "d:\scratch\export.csv"
  $csv = Import-csv -path $path
  
  foreach($line in $csv)
  { 
      foreach ($head in $line | get-member | where-object {$_.MemberType -eq "NoteProperty"} | select Definition)
      {
          #pseudocode...
          doSomething($head.columnName, $head.value)
      }
  
  }
  </code></pre>
  
  <p>How do I loop through the line in the csv file, getting the name of the column and the value? Or is there another way I should be doing this (like not using Import-csv)?</p>