开发者

What does the DOS command "findstr" do here?

From my understanding of findstr, it looks for text within files. What, then, is making it search for a pattern in the filename itself?

dir | findstr "test开发者_StackOverflow社区[0-9][0-9][0-9]test"

Does the pipe alter its behavior? Someone explain the inner working of this. I know it works, but I don't understand how it works. Thanks.


The pipe redirects the standard output of dir to the standard input of findstr, this works as findstr will use either the arguments passed to it on the command line, or anything passed to it via stdin.


I don't know findstr itself, but it looks to be similar to grep.

What it does here is take the output of dir (the directory listing) and search for some string in that output. It then only outputs those lines that match (effectively searching in the directory listing).

This process (called piping) is pretty common in Unix-like operating systems. As you see it also exists on Windows (and DOS before that).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜