批处理文件以在目录的所有文件中搜索关键字 [英] Batch file to search a keyword in all files of a directory

查看:48
本文介绍了批处理文件以在目录的所有文件中搜索关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请建议我如何搜索用户将在目录的所有文件中输入的文本字符串.

Kindly suggest how can I search a text string which will be input by the user in all files of a directory.

提前谢谢!

推荐答案

findstr 是你的朋友.

例如,要查找包含Hello的所有文件:

For example, to find all files containing Hello:

findstr Hello *

它还允许子目录搜索(/s )和正则表达式(/r ).

It also allows subdirectory searches (/s) and regular expressions (/r) as well.

当然,除非安装并使用Cygwin或GnuWin32工具,否则您无法获得 real 功能. Cygwin 如果您想要整个类似UNIX的环境或

Of course, you can't achieve real power unless you install and use the Cygwin or GnuWin32 tools. Cygwin if you want an entire UNIX-like environment or GnuWin32 if you just want select tools.

这篇关于批处理文件以在目录的所有文件中搜索关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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