windows 查詢目錄下檔案中包含某個字串

2021-07-30 10:32:06 字數 435 閱讀 8463

可以使用windows自帶的findstr.exe來實現。

findstr.exe /s /i "string" *.*  

上面的命令表示,當前目錄以及當前目錄的所有子目錄下的所有檔案中查詢"string"這個字串。

*.*表示所有型別的檔案。

/s 表示當前目錄以及所有子目錄

/i 表示不區分大小寫

可以參考help findstr的輸出解釋來使用此命令。

c:\windows\system32\findstr.exe /s /i "jsonp" *.jsp*

查詢當前目錄及子目錄下的jsp檔案中包含jsonp字串的檔案

注意:findstr.exe一般在c:\windows\system32目錄下,要從任意路徑呼叫該命令,需要將c:\windows\system32新增到path環境變數中

參考:

windows 遍歷 特定目錄下檔案

參考自 很多類似 都有 wchar char 等型別問題 s 問題。一下 在 windows10 vs2017上親測可用 cmd test.cpp 定義控制台應用程式的入口點。include stdafx.h include include include include using namespa...

目錄下檔案計數

每個linux下的path中包含的系統變數都有好多路徑 root wl ms 7673 home wl 桌面 shell echo path usr local sbin usr local bin usr sbin usr bin sbin bin usr games usr local arm ...

刪除目錄下檔案

刪除當前目錄下的檔案 1.rm f 最經典的方法,刪除當前目錄下的所有型別的檔案 2.find type f delete或find type f exec rm f 用find命令查詢普通檔案並刪除or用find命令的處理動作將其刪除 3.find type f xargs rm f 用於引數列表...