Powershell – Redirecting standard input\output in Windows PowerShell

powershellpowershell-2.0stdin

What is the required syntax to redirect standard input/output on Windows PowerShell?

On Unix, we use:

$./program <input.txt >output.txt

How do I execute the same task in PowerShell?

Best Answer

You can't hook a file directly to stdin, but you can still access stdin.

Get-Content input.txt | ./program > output.txt