在 Windows PowerShell 中重定向标准输入输出 [英] Redirecting standard inputoutput in Windows PowerShell
本文介绍了在 Windows PowerShell 中重定向标准输入输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Windows PowerShell 上重定向标准输入/输出所需的语法是什么?
What is the required syntax to redirect standard input/output on Windows PowerShell?
在 Unix 上,我们使用:
On Unix, we use:
$./program <input.txt >output.txt
如何在 PowerShell 中执行相同的任务?
How do I execute the same task in PowerShell?
推荐答案
您不能将文件直接挂接到标准输入,但您仍然可以访问标准输入.
You can't hook a file directly to stdin, but you can still access stdin.
Get-Content input.txt | ./program > output.txt
这篇关于在 Windows PowerShell 中重定向标准输入输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文