Поиск файла через командную строку windows 10

Searching for a file in Windows is not an easy job if your files are not organized and one of the ways to search your files using tags keywords in the Windows Search box inside File Explorer. However, Windows File Explorer search results are not that accurate and it takes a longer time but why wait if you can search files much faster using Windows 10 Command Prompt.  

Finding Files Using Windows 10 Command Prompt. 

You can search files on your hard drive faster using Windows Command Prompt.

Step 1: Press Start and type CMD, then press Enter to launch the Command Prompt. After successfully launching the Command Prompt, type the below command, and press Enter to pull up a list of files and folders. 

dir

Step 2: For moving down into a particular directory, use the below command followed by a folder name,  until you reach the folder you want to search.

cd folder_name

Step 3: Now type dir command again but this time with your search term, follow dir with your search term in quotes with an asterisk term before closing the quotes (For example, type dir “Raveling*”) and press Enter. The command prompt will show you the file location along with the list of files name starting with a similar keyword. 

The asterisk is what’s known as a wildcard and, in our example, it stands for anything that follows the word ‘highlands’, such as ‘raveling.doc’, ‘raveling.xls’ or My Business plans.txt’.

If you don’t know the exact location of your file in your hard drive, then instead of manually navigating through your directories, start searching from the very top level of your hard drive and include every sub-folder.

Step 4: The top level of the drive is represented by a backslash and, to include subdirectories, you add a forward slash and ‘s’ to the end of the query as shown below:

 dir “\Raveling*” /s 

The above command is my all-time favorite because, with the help of this command, I don’t have to force my brain to remember the location of the files. This trick usually takes seconds to search the entire drive for the file.  

You can also search for a particular file type by using a command dir \*.pdf /s and it will show you all files saved with the .pdf extension. You can try this for other files too (for example: .doxc, .png, .exe and more).

Note: The position asterisk symbol in the command matter a lot so type carefully and check once before executing the command.

How all these commands work.

Now you know enough to find any file on your entire hard drive within few seconds but if you are more curious to know how all these commands are working and what all these symbols stand for, then continue reading this post.

Let’s discuss each term one by one:

  • dir command is for showing files on the current directory, but it can also show files from anywhere in the drive of the system.
  • / tells dir to search from the top-level or root directory of the hard drive.
  • /s is used for searching sub-directories.
  • * asterisk is using before text (for example *.pdf) show all files ending with .pdf and * using at the end (for example raveling*) show you all file-names starting with that word.

So, this is all that you need to know for searching any file quickly within a few seconds using Windows 10 Command Prompt. 

Last Updated :
12 Mar, 2021

Like Article

Save Article

Поиск Windows может найти что угодно на вашем диске Windows. Если вам достаточно нравится эта функция, вы можете расширить поиск на другие диски в вашей системе. Есть другие приложения / утилиты, которые вы можете установить, если обнаружите, что поиск Windows не так эффективен, или если вы можете искать файлы и папки из командной строки. Вот как.

Поиск файлов и папок из командной строки

Командная строка может искать файлы и папки на определенном диске или в определенной папке. По умолчанию, если вы запускаете его с правами обычного пользователя, он открывается в вашей пользовательской папке, и вы можете или не хотите выполнять поиск в этой конкретной папке. Вот почему вам нужно знать, как переместить командную строку в другое место.

Если вы хотите выполнить поиск на других дисках без окна, вам нужно сначала переключиться на него с помощью следующей команды;

Синтаксис

drive_letter:

Пример

D:

Чтобы перейти в другую папку, используйте команду ниже. Кавычки необходимы только в том случае, если у вас есть папки, в именах которых есть пробел в пути, который вы вводите, но лучше не добавлять их в привычку.

Синтаксис

cd "path-to-folder"

Пример

cd "D:Images"

Искать файлы по типу

Следующая команда позволяет вам искать в текущей папке все файлы определенного типа.

Синтаксис

dir /b/s *.file_extension

Пример

dir /b/s *.png

Приведенная выше команда будет искать все файлы PNG в текущем каталоге и его подпапках. Параметр / s указывает команде включать подпапки, а параметр / b отображает файлы без включения метаданных, что упрощает чтение списка.

Искать файлы по имени

Для поиска файлов по имени используйте следующую команду;

Синтаксис

dir *file_name*.* /s

Пример

dir *arrow*.* /s

Вышеупомянутая команда будет искать все файлы, которые соответствуют введенному вами имени файла, независимо от типа файла. Если вы хотите сузить поиск по типу файла, введите расширение файла после точки.

Пример

dir *arrow*.jpg /s

Искать папки

Чтобы найти в папке подпапки, используйте следующую команду;

Синтаксис

dir "Name of folder to search" /AD /b /s

Пример

dir Images /AD /b /s

Помните, что приведенная выше команда будет искать подкаталоги в указанной вами папке. Если вы хотите выполнить поиск в другой папке, используйте команду cd, чтобы переместиться туда, где находится папка, а затем выполните команду.

Искать папку с неизвестным именем

Если вы не знаете, как называется папка, вы можете использовать следующую команду.

Синтаксис

dir /s/b /A:D "D:*partial-name-of-folder*"

Пример

dir /s/b /A:D "D:*Stea*"

Please try the following commands

List all files in the current directory & subdirectories

dir /b/s *.txt  

The above command searches for all txt file in the directory tree.

But as windows is started naming directories as .nuget,.vscode it also comes with the command above.

In order to avoid this and have a clean list use /a:-d filter as

dir /a:-d /b/s

Before using it just change the directory to root using

cd/

There is one more hacky command to do the same

for /r %f in (*) do @echo %f

Note: If you miss the @echo part in the command above it will try to execute all the files in the directories, and the /r is what making it recursive to look deep down to subdirectories.


Export result to text file

you can also export the list to a text file using

dir /b/s *.exe >> filelist.txt

and search within using

type filelist.txt | find /n "filename"

If you are looking for files with special attributes, you can try

List all Hidden Files

dir /a:h-d /b/s

List all System Files

dir /a:s-d /b/s

List all ReadOnly Files

dir /a:r-d /b/s

List all Non Indexed Files

dir /a:i-d /b/s

If you remove the -d from all commands above it will list directories too.


Using where in windows7+:

Although this dir command works since the old dos days but Win7 added something new called Where

where /r c:\Windows *.exe *.dll

will search for exe & dll in the drive c:\Windows as suggested by @SPottuit you can also copy the output to the clipboard with

where /r c:\Windows *.exe |clip

just wait for the prompt to return and don’t copy anything until then.

Page break with more

If you are searching recursively and the output is big you can always use more to enable paging, it will show -- More -- at the bottom and will scroll to the next page once you press SPACE or moves line by line on pressing ENTER

where /r c:\Windows *.exe |more

For more help try

where/?

Как быстро найти файл в Windows с помощью cmd ?

Приветствую вас, сейчас мы научимся, как найти файл или папку в Windows без помощи неважно работающего проводника системы, и будем использовать для этого либо команды в MS-DOS, либо с помощью его эмулятора – консоли команд cmd. У такого способа есть лишь один недостаток, который связан лишь с беспричинной боязнью пользователей перед текстовым интерфейсом работы с системой и сложившейся привычкой к графическому. Однако, по сути в обоих случаях нам всё равно приходится вручную набирать условия поиска потерявшегося файла или пакета файлов, а здесь без «вседозволенности» консоли просто не обойтись. От команд давно почившей операционной системы MS-DOS не скроется ничего, и cmd способна без труда открыть путь ко всем документам и директориям, которые находятся в чреве Windows .

Что нужно, чтобы найти файл в Windows ?

Нам нужно имя файла и программу, которая его создала либо умеет читать.

Итак, если уверены, что файл просто «потерялся», вам нужно через консоль оказаться в корневой папке системы. Для этого введём пару символов:

cd\

корневая папка windows

и вы там. Если вы точно знаете имя файла или документа, это не проблема даже для поисковика Windows. Но есть ведь задача и посложнее…

А теперь, представьте, что вам нужно найти файл или документ, имя которого вы и толком-то не помните. Допустим, в названии что-то было про «установку». То-ли «установкА», то-ли «установкИ», то-ли «установОК»… Не проблема – так Windows и спросите:

dir *установ*.* /s

где

  • dir – команда отобразить список файлов и директорий
  • * — что-то там… (ну забыл я, мол)
  • . – расширение файла (текстовый, музыка, PDF-ка, фильм и т.п.)
  • /s – команда на поиск в текущей директории и подкаталогах.

как найти файл в Windows

Результаты через пару мгновений будут выглядеть примерно так:

результаты поиска

На этот же манер можно найти файл, если вы знаете, какое расширение он имеет, т.е. какой программой открывается. Командой

dir *.xls /s

или

dir *.docx /s

можно будет найти документы Exel и Word. Присмотритесь к примерам разновидностей команд (вариаций здесь множество):

dir *.txt *.doc

отобразит в одной выдаче документы с расширениями .doc и .txt

dir /p

команда с этим атрибутом (в отличие от /s) поможет. если результатов будет множество, а вам удобнее просматривать их с небольшим интервалом.

dir /on

выдаст список файлов и директорий в алфавитном порядке

dir \ /s |find "i" |more

отображает все папки и их содержимое, включая время создания, количество файлов в каждой, сколько места занимают.

Успехов

windows where command

In the Windows command prompt (CMD), we use the where command to find files that match a specific search pattern.

where /r dir file_name

The where command searches for files in the given directory and all subdirectories and returns the full path of each matching file to the standard output.

First, let’s look at a few examples to understand how CMD where command works.

Examples

Search c:\ drive for the file file1.txt:

where /r c:\ file1.txt

Find the location of the chrome.exe:

where /r c:\ chrome.exe

The following command finds all files that contain «report» anywhere in the filename in the c:\windows and all subdirectories:

where /r c:\windows *report*

This command search c:\ drive to find filenames starting in «report»:

where /r c:\ report*

The following command search c:\ drive to find filenames ending in «report»:

where /r c:\ *report

In this example, every file in the c:\windows (and all subdirectories) is searched for filenames ending in .txt:

where /r c:\windows *.txt

Find all mp3 files in the d:\ drive:

where /r d:\ *mp3

The following command finds all mp3 files in the d:\ drive and copies the output to the clipboard instead of printing it to the command prompt.

where /r d:\ *mp3 | clip

In this example, we save the output to a text file called output.txt:

where /r d:\ *mp3 > C:\output.txt

Add the /t option to display the file size and last modification date and time:

where /t /r c:\windows *.log

Command Options

/r Dir Specify the directory to search (the search is recursive).
/f If you use this option, the where command encloses filenames in quotation marks in the output.
/t Displays file size and last modification date.
/? Displays command options.

If you know the exact name of the file you want to find, then specify the name without using any wildcards:

where /r c:\ file1.txt

The above command will search for file1.txt in C: drive recursively.

cmd where command

If you don’t know the exact name, but only a part of it, then put an asterisk (*) before and after the search term, as shown in the following example:

where /r c:\Docs *report*

In the above example, CMD where command will return any files that have the string report anywhere in the filename.

Find files using the where command

To find files that start with a specific pattern, put an asterisk (*) after the search term, as shown in the following example:

where /r c:\ report*

To find files that end with a specific pattern, put an asterisk before the search term:

where /r c:\ *report

In the following example, the where command finds all files that have the .avi extension on the C: drive:

where /r c:\ *.avi

Remarks

  • You can only use the where command to find files on CMD. It will not work on Windows PowerShell.
  • Run the where /? command to see a list of all the options.

  • Поиск файла по типу файла в windows 10
  • Поиск файлов по автору windows
  • Поиск в диспетчере задач windows 10 что это
  • Поиск файла по названию windows 10
  • Поиск в диспетчере задач windows 10 как отключить