Search code examples
powershellpowershell-2.0stdin

Redirecting standard input\output in Windows PowerShell


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?


Solution

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

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