magnifying glass laying on keyboard

Q. How can I use Get-Content to read and parse a comma-separated value (CSV) file in PowerShell?

Q. How can I use Get-Content to read and parse a comma-separated value (CSV) file in PowerShell?

A. Don't. Anytime you're parsing text, you're probably working too hard. The Import-CSV cmdlet already knows how to parse a CSV file, so just use that.

Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish