停止DIR命令搜索先打被发现后, [英] Stop DIR command searching after first hit is found

查看:214
本文介绍了停止DIR命令搜索先打被发现后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CMD.EXE我可以用搜索的东西 DIR - 以下面的例子:

In CMD.EXE I can search for something using DIR - take the below example:

DIR C:\*EXCEL.EXE /A:-D /B /S

虽然这将需要一段时间通过C的整体结构来获得:\\驱动器,第一场比赛是比较快

Although it will take a while to get through the whole structure of the C:\ drive, the first match is relatively quick.

问:有没有办法来的自动的持续,一旦一击已发现搜索停止命令

Q: Is there a way to automatically stop the command from continuing the search once a hit has been found?

我这么问是因为我其实是想外壳CMD提示符并读取标准输出到另一个脚本,但会有一个很长的停顿,如果我等待整个搜索完成。

I'm asking because I actually want to shell a cmd prompt and read the StdOut to another script, but there will be a very long pause if I wait for the entire search to finish.

推荐答案

您不能停止 DIR ,但您可以使用anoter方式:

you can't stop dir, but you can use anoter method:

for /r "c:\" %%i in (excel.exe) do (echo -- %%i & goto :eof)

这篇关于停止DIR命令搜索先打被发现后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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