Windows recursive grep command-line

2019-01-20 21:20发布

I need to do a recursive grep in Windows, something like this in Unix/Linux:

grep -i 'string' `find . -print`

or the more-preferred method:

find . -print | xargs grep -i 'string'

I'm stuck with just cmd.exe, so I only have Windows built-in commands. I can't install Cygwin, or any 3rd party tools like UnxUtils on this server unfortunately. I'm not even sure I can install PowerShell. Any suggestions using only cmd.exe built-ins (Windows 2003 Server)?

8条回答
ら.Afraid
2楼-- · 2019-01-20 21:58

I recommend a really great tool:

native unix utils:

Just unpack them and put that folder into your PATH environment variable and voila! :)

Works like a charm, and there are much more then just grep ;)

查看更多
趁早两清
3楼-- · 2019-01-20 22:02

Recursive search for import word inside src folder:

> findstr /s import .\src\*
查看更多
登录 后发表回答