How to save each line of text file as array through powershell
The Get-Content command returns each line from a text file as a separate string, so will give you an array (so long as you don’t use the -Raw parameter; which causes all lines to be combined to a single string). [string[]]$arrayFromFile = Get-Content -Path ‘C:\USER\Documents\Collections\collection.txt’ In his excellent answer, mklement0 gives a lot more detail … Read more