重定向标准输入\\输出在Windows PowerShell [英] Redirecting standard input\output in Windows Powershell

查看:2667
本文介绍了重定向标准输入\\输出在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆