查找文件
用dir
命令查找文件
/s
是指列出当前目录包含子目录下的所有文件/b
是仅列出文件名称,而日期、大小等其它信息则忽略
示例:
C:\Users\mt\Desktop>dir 2019* /s /b
C:\Users\mt\Desktop\2019-01-09-history.log
C:\Users\mt\Desktop\20190109加班申请表.doc
C:\Users\mt\Desktop\20190110
C:\Users\mt\Desktop\新建文件夹 (3)\20190108-1143_PrintFlat_PrintFlat_modules_
incr.jar
查找文件内容
用findstr
命令查找文件内容
/s
在当前目录及所有子目录中的文件中搜索匹配/n
显示匹配行的行号
示例
C:\Users\mt\Desktop>findstr /s /n "replace" C:\Users\mt\Desktop\2019-01-09
-history.log
用find
命令查找文件内容
/N
显示匹配行的行号/I
搜索字符串时忽略大小写/C
仅显示包含字符串的行数/V
显示所有未包含指定字符串的行
示例
C:\Users\mt\Desktop>find /N /I "replace" C:\Users\mt\Desktop\2019-01-09