+4 votes
456 views
How to use Find command in Windows 10, 8, 7

in Windows 10 by (551k points)
reopened | 456 views

1 Answer

+5 votes
Best answer

1. Parameters of the find command in Windows
2. Search with the Find command in Windows
3. Search multiple documents for the same Windows string
4. Count the number of lines in a Windows file

Each current operating system brings multiple tools designed to optimize its use and increase its management possibilities. In the case of Windows operating systems, we have a series of commands through the command prompt that will give us the opportunity to manage certain tasks within the system and one of these is the Find command..

Searching for items through the browser may be the most appropriate option for many users because of its simplicity, but remember that this type of search is subject to indexing parameters which can make it a slow and complex task. The find command has been developed to allow us to perform various types of search in Windows in a simple and functional way.

Basically the find command, search for a text string in a file or several files and display the lines of text that contains the selected string..

Use the Find command
To use the find command in Windows, in this case Windows 10, we must access the command prompt as administrators. To do this, we enter the term cmd in the Windows search box, and we will right click on the command prompt and select the option Run as administrator:

image

We accept the warning from the UAC.


1. Parameters of the find command in Windows


Once we access the command prompt we can execute the following line to obtain in detail the various options to use with this command:
 find /? 

image

There we must take into account the following
  • The switches can be lowercase or uppercase without affecting the search
  • When using the "string" parameter, double quotes must be added to the string, otherwise the search command will not work and will return an error in response.
  • The [drive:] [path] file parameter can be any element, from a drive letter to one or more files.

The syntax to use with the find command on Windows systems is:

 find [switches] "string" [file] 
The switches can be in any order, but they must always be before the "string" parameter.
We must take into account some tips before running find on Windows
  • Specify a string: If we do not use the / i parameter, the find command will search for exactly what we indicate in the string. Recall that if we use / i will not identify lower case letters, B and b will be the same, while if we do not use the letters will be taken into account.
  • Use the find command as a filter: If you omit a file, the find command will act as a filter by taking the standard input source and then displaying the lines that contain the String line.
  • It is possible to write parameters and command line options for the find command in any order.
  • Use of wildcards: The use of wildcards * and? in file extensions. To search for a string in a set of files that we use with wildcards, it is possible to use the find command within a for command.
  • It is allowed to use / cy / v on the same command line

2. Search with the Find command in Windows


For this case, we must specify what text we will look for and in which route we should look for that text.
Let's use this example:
 find "TechnoWikis" "D: \ TechnoWikis \ solvetic.txt" 
The result will be as follows:

image

To see the importance of upper or lower case we will execute the following:

 find "solvetic" "D: \ TechnoWikis \ solvetic.txt" 
We will see the following:

image

We can see that the result does not emit any results below the line. If we want the search to run without distinguishing upper or lower case, we can use the / i parameter as follows:

 find / i "solvetic" "D: \ TechnoWikis \ solvetic.txt" 
In this case, the term TechnoWikis will be searched without differentiating the case:

image


3. Search multiple documents for the same Windows string


Another option that allows us to perform the find command is to search for a text string in one or more documents, in this case we must indicate each separate route and with quotes like this:
 find / i "solvetic" "D: \ TechnoWikis \ solvetic.txt" "D: \ TechnoWikis \ solvetic1.txt" "D: \ TechnoWikis \ solvetic2.txt" 

image

If we do not want to enter route by route, it will be possible to search all text files in a directory using the wildcard character, (*), as follows:

 find / i "solvetic" "D: \ TechnoWikis \ *. txt” 

image


4. Count the number of lines in a Windows file


With the use of the type and find commands it will be possible to determine the number of lines a file has.

In this case, we will channel the results of the type command with the find command using the vertical bar (|), then we will use the "/ v" switch to show all the lines that do not contain the "" string, and this will get it counted every line with text To show only the number of lines in the text file we can use the "/ c" switch:

 type D: \ TechnoWikis \ solvetic.txt | find "" / v / c 

image

Send the output of another command to the Search command It is possible to search all file names in a specific directory for a given chain by channeling the output of the dir command to the find command.

For this case we have the directory D: \ TechnoWikis \ and we will obtain the subdirectories using the / s parameter. Then we will specify a format without header or summary information using the / by parameter and display the result in a wide list format with the / w parameter..

Then, we channel with the bar, (|), the output of the dir command in the find command.

 dir “D: \ TechnoWikis” / s / b / d | find "TechnoWikis" 

image

In this way the find command allows us to search certain types of files in a simple and functional way on Windows systems.


by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Oct 5, 2019 in Windows 10 by backtothefuture (551k points) | 835 views
+3 votes
1 answer
asked Oct 21, 2019 in Windows 10 by backtothefuture (551k points) | 325 views
+4 votes
1 answer
+5 votes
1 answer
+5 votes
1 answer
asked Jun 12, 2020 in Windows 10 by backtothefuture (551k points) | 299 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users