Input output (I/O) Redirection in Windows Powershell
Input output redirection allows you to redirect the output of Cmdlet to file or any other valid storage device.
- Out-Null : This command sends output to null device. It is same as /dev/null in Linux.
- Out-File : This command sends output to the file.
- Out-Printer : This command sends output to a printer.
- Out-GridView : This command sends output in GUI window.
- Out-String : This command sends output as a string to host.
- Out-Default :
For example – If you execute command “Get-Process”, output is displayed on the screen. But if you want to store that information in a file, you can redirect the output to file using below command.
Get-Process > ProcessList.txt
Similarly we can redirect input as well. Instead of reading input from standard input stream (Keyboard), we can read from file stream or any other valid stream.