$lines=Get-Content myfile.txt $lines | ForEach-Object{ Test-Connection $_.Split(' ')[1] } <source lang="html4strict"> $lines=Get-Content myfile.txt $lines | ForEach-Object{ Write-Host $_ }