【问题标题】:I want to take run an executable and take input from a text file and then write the output in Windows cmd我想运行一个可执行文件并从文本文件中获取输入,然后在 Windows cmd 中写入输出
【发布时间】:2015-08-27 20:57:11
【问题描述】:

在 ubuntu 中,我会通过以下命令来完成

./a.out < input.txt | cat > ouput.txt

如何在 Windows cmd 中执行此操作?

【问题讨论】:

  • file.exe c:\yourinput.txt > c:\output.txt ??
  • a.exe &lt; input.txt &gt; output.txt(PS:在 Linux 中你可能不需要cat./a.out &lt; input.txt &gt; output.txt 应该可以工作。
  • 我认为 Windows 没有 cat

标签: c windows cmd io-redirection


【解决方案1】:

你可以用两行来完成:

a.exe < input.txt >output.txt
type output.txt

【讨论】:

    【解决方案2】:

    假设 a.exe 写入 STDOUT,这应该可以工作:

    a.exe < C:\path\to\input.txt > C:\path\to\output.txt
    

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 1970-01-01
      • 2018-02-24
      • 2010-12-14
      • 2021-09-25
      • 1970-01-01
      • 2011-05-18
      • 1970-01-01
      • 2018-02-11
      相关资源
      最近更新 更多