banner



How To Find Cmd In Windows Xp

Find 0

Find is another nifty command line tool that every Windows user should know about because it can be used to search content of files for specific strings of text.

Notice's Switches and Parameters

Every bit with every command prompt based tool in Windows, there are certain switches and parameters you will demand to know in order to use the tools effectively. These are listed and explained below.

  1. /v – This switch will show any lines that don't contain the cord of words you specified.
  2. /c – This switch tells the detect tool to count how many lines comprise your search terms.
  3. /n – This switch shows the numbers that stand for with the lines.
  4. /i – This switch tells find to ignore the case of text you lot are searching for.

In addition to these switches, at that place are ii parameters which you can specify with this tool.

  1. "String" – The string will be the words y'all are searching for in your documents. You must always remember to keep this secrtion surrounded by quotation marks, otherwise your command will return an error.
  2. Pathname – This parameter is where you lot volition specify the location that you lot desire to search. This can be equally wide as listing a drive or as specific as defining a single or multiple files. If you don't specify a path, Notice will ask you for text input or may accept text piped from another command. When you are ready to end the transmission text input, you can press "Ctrl + Z." We will discuss this more later.

Find's Syntax

Like every tool in windows, yous will need to know how to enter your commands. The syntax below is the perfect model.

FIND [SWITCH] "String" [Pathname/south]

Depending on your command, y'all volition receive one of 3 %errorlevel%  responses.

  1. 0 – The string yous were searching for was found.
  2. i – The string you lot were searching for was not found.
  3. 2 – This ways you had a bad switch or your parameters were incorrect.

Let's Practise

Before we get started, you should download our three sample text documents which we will use for the test.

  1. document
  2. sample
  3. exercise

These documents each contain a paragraph of text with a few similar word groupings. In one case you have downloaded these three documents, you lot can copy them into whatever binder on your figurer. For the purposes of this tutorial, we will put all three text documents on the desktop.

At present you will demand to open up an elevated command prompt window. Open up the start menu in Windows 7 and 10 or open up the search function in Windows 8 and search for CMD. Next, right-click on it and then press "Run as administrator." While you don't demand to open up an elevated command prompt window, information technology volition help you lot to avoid any pesky confirmation dialog boxes.

Find 1

Our tutorial today volition encompass several simple scenarios which will be elaborated on below.

  1. Search a single document for a string of words.
  2. Search multiple documents for the aforementioned string of words.
  3. Count the number of lines in a file or multiple files.

Scenario i – Search a unmarried document for a string of words.

Now that you have your three documents downloaded, we volition enter a command to search the text file called "exercise" for the words "martin hendrikx." Employ the command shown below. Call back to put your search string in quotation marks and change the path to match the folder where your documents are saved.

find "martin hendrikx" C:\Users\Martin\Desktop\exercise.txt

Find 2

Y'all will notice that no results showed upward. Don't worry, you did nothing incorrect. The reason you have no results is because FIND is looking for an exact match to your search string. Let's try it again, but this fourth dimension, let's add together the "/i" switch so that Discover ignores the instance of your search cord.

find /i "martin hendrikx" C:\Users\Martin\Desktop\exercise.txt

Find 3

Now you can see that Notice brought upwards i line that matches the search string, which means it is working. Permit's try this once again, but change the search cord to "sushi"; if your results expect like the epitome beneath, you did it right.

Find 4

Scenario 2 – Search multiple documents for the aforementioned cord of words.

Now that you know how to do a basic search, let's endeavor to widen the span of the search. We will now search two of the text files (exercise and sample) for the term "sushi." Practice this by entering the following string. Recollect to change the path to match the location of your files and add the "/i" switch so that your search is non case-sensitive.

find /i "sushi" C:\Users\Martin\Desktop\exercise.txt C:\Users\Martin\Desktop\sample.txt

Find 5

Yous will discover that the search terms were found in both documents and the sentences in which they were plant, are listed nether their respective file names and locations. Try this again, but this fourth dimension, add together the third file to the Detect command and search for the word "potato" instead. Your search results should await like the epitome below.

Find 6

Note that the text found in each document is really "potatoes" which means that even if you type a part of a discussion, y'all will see any phrases that contain the search cord. Alternatively, yous could use this command to check all text files.

discover /i "sushi" C:\Users\Martin\Desktop\*.txt

Scenario 3 – Count the number of lines in a file.

If you want to know how many lines there are in a file, you can use the search control beneath. Remember to add a infinite between all your switches. In this instance, we will replace the pathname with that of the "sample.txt" file. If you want only a number every bit your result, use this control:

type C:\Users\Martin\Desktop\sample.txt| find "" /v /c

Find 7

If yous want the number and the file info, employ this command:

find /v /c "" C:\Users\Martin\Desktop\sample.txt

Find 8

If y'all want to count the lines in multiple files on the desktop, use the following command.

find /v /c "" C:\Users\Martin\Desktop\*.txt

Find 9

You tin can at present experiment with a few unlike commands and familiarize yourself with the tool. It can help to save a lot of time in the future once you have a organization created. Take fun and keep on geeking.

Image Credit: Littlehaulic on Flickr.com

Source: https://www.howtogeek.com/206097/how-to-use-find-from-the-windows-command-prompt/

Posted by: taylorsquinged.blogspot.com

0 Response to "How To Find Cmd In Windows Xp"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel