我想通过 Windows 命令行(不是 power shell)快速搜索给定名称或部分名称的文件。这类似于打开资源管理器并使用顶部的搜索框。
注意:dir
可以根据字符串模板进行搜索,但不会在子目录中进行搜索。
注2:findstr
可用于在文件中搜索 token ,并具有递归标志;有趣的是,更复杂的发现很容易被发现......
最佳答案
dir/s *foo*
在当前文件夹和子文件夹中搜索。
它查找目录和文件。
其中/s 表示 (documentation) :
/s Lists every occurrence of the specified file name within the specified directory and all subdirectories.
关于windows - 如何在cmd中进行简单的文件搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8066679/