Scripting >> Powershell >> Syntax >>  Reading from or Writing to a file

Reading from a file =================== $a = Get-Content "c:\servers.txt" foreach ($i in $a) {$a} Writing to a Simple File ======================== $a = "Hello world" $a | out-file test.txt or use > to redirect output of the script results to a file .\test.ps1 > test.txt