如何在DOS下使用另一个命令的输出来运行命令?

时间:2009-09-25 21:12:34

标签: scripting command dos if-statement

示例:

for /? | if (this stream has word "the" in it) {echo the line with "the"}

我需要以某种方式分析重定向流中的文本。

2 个答案:

答案 0 :(得分:0)

http://www.febooti.com/products/command-line-email/batch-files/ms-dos-command-redirection.html

本网站提供有关您在DOS中可以做的不同类型管道的良好信息。

答案 1 :(得分:0)

使用管道,使用竖线“|”。

例如:

的输出输出到 find

for /? | find "the"

输出的前几行:

  command    Specifies the command to carry out for each file.
             Specifies parameters or switches for the specified command.
To use the FOR command in a batch program, specify %%variable instead
If Command Extensions are enabled, the following additional
forms of the FOR command are supported:
    If set contains wildcards, then specifies to match against directory
相关问题