c - 如何将文件通过管道传输到 cmd.dir/s *.txt>search.txt|find "name"中的 Find 命令不起作用

标签 c cmd pipe

我想在不使用 dir/s subhang.txt 的情况下查找是否存在名为 name 的文件。你能告诉我如何使用管道来完成它以及如何使用管道连接两个 C 程序吗

最佳答案

命令:

dir/s *.txt >search.txt | find "name"

... 不起作用,因为 dir/s 的输出进入文件 search.txt。如果您尝试:

dir/s *.txt | find "name"

... 将 find 的结果输出到控制台,或者

dir/s *.txt | find "name" >search.txt 

...将查找的结果输出到文件search.txt

关于c - 如何将文件通过管道传输到 cmd.dir/s *.txt>search.txt|find "name"中的 Find 命令不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19190148/

相关文章:

c - Fortran 2003 绑定(bind)到 C : how to translate enums and #defines? 中的库

java - 通过java程序在命令提示符下读写多个命令

c - Windows 批处理/每行多个命令

c - 为什么我的管道 grep 不工作?

r - R 的新原生管道 `|>` 和 magrittr 管道 `%>%` 有什么区别?

控制程序输出的滚动

c - 从 Windows 内部修改 SMBIOS

c - Lua错误没有传递 bool 值

c - 从另一个 exe 运行 exe

pipe - 将 pv 输出(stderr)打印到文件