输入输出重定向

常用的重定向:

输出重定向:

for example

CMD下,当前目录为D盘, 把dir的输出结果重定向到data.txt中

d: \>dir > data.txt

把ConsoleDemo.exe输出到屏幕的内容重定向到output.txt文件中

d:\>ConsoleDemo.exe > output.txt

输入重定向:

把input.txt文件的内容作为参数传递给ConsoleDemo.exe

CMD下,当前目录为D盘,

d:\>ConsoleDemo.exe < input.txt

原文地址:https://www.cnblogs.com/BeyondTechnology/p/1996631.html