Read Line by Line in a Loop from a Text File using PowerShell

How to use PowerShell to read a line from a text file.

First read from a text file using Powershell. Then using the loop named FOREACH.

$file = Get-Content "C:\File.txt"

foreach ($line in $file) 
    Write-Output "The name is: $line"


Leave a Comment

All fields are required. Your email address will not be published.