你如何重定向标准输入到Windows命令行的文件? [英] How do you redirect standard input to a file in the Windows command line?

查看:781
本文介绍了你如何重定向标准输入到Windows命令行的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix上我会做这样的事情:

On Unix I would do something like:

cat > file.txt

我怎样才能做到这一点在Windows命令提示符或批处理文件?

How can I do this on the Windows command prompt or batch file?

编辑:基本上,我正在寻找的功能不带参数(从标准输入读取和吐回了到stdout )。

Basically, I am looking for the functionality of cat with no arguments (it reads from stdin and spits it back out to stdout).

推荐答案

TYPE CON

CON是控制台输入的MS-DOS设备。您可以重定向到一个文件如下:

CON is the MS-DOS device for console input. You can redirect to a file as follows:

TYPE CON> output.txt的

要终止,按<大骨节病>控制 + <大骨节病> C 或<大骨节病>控制 + <大骨节病>以Z ,<大骨节病>输入(<大骨节病>控制 + <大骨节病>以Z = EOF)。

To terminate, hit Ctrl + C or Ctrl + Z, Enter (Ctrl + Z = EOF).

这篇关于你如何重定向标准输入到Windows命令行的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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