Redirecting standard input\output in Windows PowerShell

Nitin picture Nitin · Jul 12, 2012 · Viewed 43.9k times · Source

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?

Answer

JasonMArcher picture JasonMArcher · Aug 3, 2012

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

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