what to do when writing to set up computer windows visita in command promt

Find 0

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

Find's Switches and Parameters

As with every command prompt based tool in Windows, there are sure switches and parameters you will need 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 string of words you specified.
  2. /c – This switch tells the discover tool to count how many lines contain your search terms.
  3. /n – This switch shows the numbers that correspond with the lines.
  4. /i – This switch tells detect to ignore the case of text you are searching for.

In addition to these switches, there are ii parameters which yous can specify with this tool.

  1. "String" – The string will be the words you are searching for in your documents. You must always remember to go on this secrtion surrounded by quotation marks, otherwise your command will return an error.
  2. Pathname – This parameter is where you lot will specify the location that y'all desire to search. This can be as broad as listing a drive or every bit specific every bit defining a unmarried or multiple files. If you don't specify a path, FIND volition ask y'all for text input or may take text piped from some other control. When you are prepare to end the manual text input, you tin can press "Ctrl + Z." We will hash out this more later.

Find's Syntax

Like every tool in windows, you lot volition demand to know how to enter your commands. The syntax beneath is the perfect model.

Find [SWITCH] "String" [Pathname/due south]

Depending on your command, you will receive i of 3 %errorlevel%  responses.

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

Allow's Do

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

  1. certificate
  2. sample
  3. practise

These documents each contain a paragraph of text with a few similar discussion groupings. One time you take downloaded these three documents, you lot can copy them into any folder on your computer. For the purposes of this tutorial, we will put all three text documents on the desktop.

At present you lot volition need to open up an elevated command prompt window. Open the start card in Windows 7 and 10 or open up the search function in Windows 8 and search for CMD. Adjacent, right-click on information technology and and so press "Run as ambassador." While yous don't need to open an elevated command prompt window, it will assist yous to avoid whatever pesky confirmation dialog boxes.

Find 1

Our tutorial today will cover several simple scenarios which volition be elaborated on beneath.

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

Scenario 1 – Search a single document for a string of words.

Now that you lot have your three documents downloaded, we will enter a command to search the text file chosen "exercise" for the words "martin hendrikx." Use the control shown below. Recall to put your search string in quotation marks and change the path to friction match the binder where your documents are saved.

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

Find 2

You will notice that no results showed upwardly. Don't worry, you did null wrong. The reason you take no results is because Find is looking for an exact match to your search string. Permit's try it over again, merely this time, let's add the "/i" switch so that FIND ignores the case of your search string.

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

Find 3

Now you lot can run into that Notice brought up one line that matches the search string, which means information technology is working. Let's attempt this again, just change the search string to "sushi"; if your results expect like the image beneath, you did it correct.

Find 4

Scenario ii – Search multiple documents for the same string of words.

Now that yous know how to do a basic search, let's try to widen the span of the search. We volition at present search two of the text files (practise and sample) for the term "sushi." Practice this by entering the following string. Remember to change the path to lucifer the location of your files and add the "/i" switch so that your search is not case-sensitive.

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

Find 5

Yous will detect that the search terms were found in both documents and the sentences in which they were found, are listed under their corresponding file names and locations. Try this again, merely this time, add the third file to the FIND command and search for the give-and-take "potato" instead. Your search results should look like the image below.

Find 6

Note that the text found in each document is actually "potatoes" which ways that even if you type a role of a discussion, y'all volition see whatever phrases that contain the search cord. Alternatively, y'all could use this command to check all text files.

detect /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 command beneath. Remember to add together a space between all your switches. In this case, we will supercede the pathname with that of the "sample.txt" file. If you want simply a number as your result, use this control:

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

Find 7

If you want the number and the file info, utilize this command:

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

Find 8

If you desire to count the lines in multiple files on the desktop, use the following command.

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

Find 9

You tin now experiment with a few different commands and familiarize yourself with the tool. It can assistance to save a lot of time in the future once y'all take a system created. Have fun and go along on geeking.

Image Credit: Littlehaulic on Flickr.com

johnsoncous1959.blogspot.com

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

0 Response to "what to do when writing to set up computer windows visita in command promt"

ارسال یک نظر

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel