powershell redirect output to file and console code example
Example 1: powershell output to file
ls | Out-File -FilePath c:\PATH\TO\FOLDER\OUTPUT.txt
Example 2: powershell output text file
Out-File fileName
ls | Out-File -FilePath c:\PATH\TO\FOLDER\OUTPUT.txt
Out-File fileName