powershell - 在 Windows PowerShell 中重定向标准输入\输出

标签 powershell powershell-2.0 stdin

在 Windows PowerShell 上重定向标准输入/输出所需的语法是什么?

在 Unix 上,我们使用:

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

如何在 PowerShell 中执行相同的任务?

最佳答案

您无法将文件直接挂接到标准输入,但您仍然可以访问标准输入。

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

关于powershell - 在 Windows PowerShell 中重定向标准输入\输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11447598/

相关文章:

xml - 如何从XML获取参数并执行exe列表?

powershell - Powershell流水线数据到外部控制台应用程序

powershell - 从for循环中调用Powershell函数

适用于 AWS 的 PowerShell : List only "folders" from S3 bucket?

.net - 使用挂载点时,如何查找给定NTFS路径所在的卷?

Powershell - 在 json 字符串中添加变量

powershell - 为什么 get-process -computername 会返回无法连接到远程计算机错误?

Python - 从类中访问 sys.stdin 不起作用

c - 为标准输入中输入的每一行打印行号

regex - 使用PowerShell从文本文件中提取表