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.
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.
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.