How to get PowerShell to read line by line and pass it into another command?
Ok it turns out that it was not that difficult but I'll leave it here for the future people of the internet.
PowerShell has a defined set of Loops, one of them called ForEach
One can simply do:
ForEach ($line in Get-Content [File]) {[Command]) $line}
Where [File]
is the file path you're reading from and
Where [Command]
is the command you're sending each line into.
Just as an example:
ForEach ($line in Get-Content thingstoecho.txt) {echo $line}