使用findstr命令来实现搜索字符串所在文件的需求,详情可查看官方文档。
该命令在powershell和cmd下可用。
1 2 3 4 5
| findstr /s import *.py
findstr /s /i import *.py
|
以上命令均会列出所有的含有import字符串的py文件及其相对于当前目录的路径。
输出如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| PS C:\Users\Arvin>findstr /s /i import *.py core\globalManager.py:from typing import TypedDict, Union, Any core\globalManager.py:from PyQt5 import Qt as Q core\globalManager.py:from utils import SingletonClass core\textcore.py:from utils import SingletonClass core\textcore.py:import win32clipboard core\__init__.py:from .textcore import TextCore main.py:import sys main.py:from typing import List main.py:from widget.menubar import MenuButtonType main.py:from PyQt5 import Qt as Q main.py:from widget import MenuBar, TextViewer main.py:from utils.buttons import buttons as custom_buttons utils\buttons.py:from widget.menubar import MenuButtonType utils\buttons.py:from typing import List utils\clipboard.py:import win32clipboard utils\clipboard.py:from typing import Union utils\messagebox.py:from PyQt5 import Qt as _Q utils\__init__.py:import messagebox widget\menubar.py:from PyQt5 import Qt as Q widget\menubar.py:from typing import TypedDict, List, Callable widget\menubar.py:from core import TextCore widget\menubar.py:import core widget\menubar.py:from functools import partial widget\menubar.py:from utils.clipboard import get_clipboard widget\menubar.py:from text import MenuBar as MText, TextViewer widget\textviewer.py:from PyQt5 import Qt as Q widget\textviewer.py:from core import TextCore widget\textviewer.py:import win32clipboard widget\textviewer.py:from typing import Union widget\textviewer.py:from utils.clipboard import get_clipboard widget\textviewer.py:from text import TextViewer as Text widget\__init__.py:from .menubar import MenuBar widget\__init__.py:from .textviewer import TextViewer
|
更多的其他用途请查看官方文档。