Baru & hangat
  • News
    • Berita Indonesia
    • Berita Dunia
  • Teknologi
    • Teknologi Digital
  • Kesehatan
    • Penyakit & Gejala
    • Nutrisi
  • Travel
    • Bepergian di Asia
    • Bepergian di Eropa
  • Review Mobil
  • Nonton Film
    • Film Laga
    • Film Fantasi
    • Film Komedi
    • Film Romantis & Cinta
    • Kartun & Anime
    • Film Horor
  • Dengerin Musik
    • Musik Populer
    • Dangdut
    • Musik Instrumental
  • Pria
    • Gadis Seksi
No Result
View All Result
  • News
    • Berita Indonesia
    • Berita Dunia
  • Teknologi
    • Teknologi Digital
  • Kesehatan
    • Penyakit & Gejala
    • Nutrisi
  • Travel
    • Bepergian di Asia
    • Bepergian di Eropa
  • Review Mobil
  • Nonton Film
    • Film Laga
    • Film Fantasi
    • Film Komedi
    • Film Romantis & Cinta
    • Kartun & Anime
    • Film Horor
  • Dengerin Musik
    • Musik Populer
    • Dangdut
    • Musik Instrumental
  • Pria
    • Gadis Seksi
No Result
View All Result
Baru & hangat
No Result
View All Result
Home Teknologi Teknologi Digital

How to Use Find from the Windows Command Prompt

by Bagus Makarim
16/06/2020
in Teknologi Digital
How to Use Find from the Windows Command Prompt
0
SHARES
12
VIEWS
Share on FacebookShare on Twitter

Find 0

Find is another great 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.

Find’s Switches and Parameters

As with every command prompt based tool in Windows, there are certain 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 find 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 find to ignore the case of text you are searching for.

In addition to these switches, there are two parameters which you 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 keep this secrtion surrounded by quotation marks, otherwise your command will return an error.
  2. Pathname – This parameter is where you will specify the location that you want to search. This can be as broad as listing a drive or as specific as defining a single or multiple files. If you don’t specify a path, FIND will ask you for text input or may accept text piped from another command. When you are ready to end the manual text input, you can press “Ctrl + Z.” We will discuss this more later.

Find’s Syntax

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

FIND (SWITCH) "String" (Pathname/s)

Depending on your command, you will receive one of three %errorlevel%  responses.

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

Let’s Practice

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. Once you have downloaded these three documents, you 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.

Now you will need to open up an elevated command prompt window. Open the start menu in Windows 7 and 10 or open 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 need to open an elevated command prompt window, it will help you to avoid any pesky confirmation dialog boxes.

Find 1

Our tutorial today will cover 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 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 have your three documents downloaded, we will enter a command to search the text file called “exercise” for the words “martin hendrikx.” Use the command shown below. Remember 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:UsersMartinDesktopexercise.txt

Find 2

You will notice that no results showed up. Don’t worry, you did nothing wrong. 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 time, let’s add the “/i” switch so that FIND ignores the case of your search string.

find /i "martin hendrikx" C:UsersMartinDesktopexercise.txt

Find 3

Now you can see that FIND brought up one line that matches the search string, which means it is working. Let’s try this again, but change the search string to “sushi”; if your results look like the image below, you did it right.

Find 4

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

Now that you know how to do a basic search, let’s try to widen the span of the search. We will now search two of the text files (exercise and sample) for the term “sushi.” Do this by entering the following string. Remember to change the path to match the location of your files and add the “/i” switch so that your search is not case-sensitive.

find /i "sushi" C:UsersMartinDesktopexercise.txt C:UsersMartinDesktopsample.txt

Find 5

You will notice 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, but this time, add the third file to the FIND command and search for the word “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 means that even if you type a part of a word, you will see any phrases that contain the search string. Alternatively, you could use this command to check all text files.

find /i "sushi" C:UsersMartinDesktop*.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 below. Remember to add a space between all your switches. In this case, we will replace the pathname with that of the “sample.txt” file. If you want only a number as your result, use this command:

type C:UsersMartinDesktopsample.txt| find "" /v /c

Find 7

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

find /v /c “” C:UsersMartinDesktopsample.txt

Find 8

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

find /v /c “” C:UsersMartinDesktop*.txt

Find 9

You can now experiment with a few different commands and familiarize yourself with the tool. It can help to save a lot of time in the future once you have a system created. Have fun and keep on geeking.

Image Credit: Littlehaulic on Flickr.com

Tags: computer tipsinstruksi komputertips on digital devices

Related Posts

How to Add Part of a Song to a PowerPoint Presentation
Teknologi Digital

How to Add Part of a Song to a PowerPoint Presentation

19/06/2020
How to View a Slideshow on Windows 10
Teknologi Digital

How to View a Slideshow on Windows 10

19/06/2020
The New Microsoft Edge Is Now “Ready for Everyday Use”
Teknologi Digital

The New Microsoft Edge Is Now “Ready for Everyday Use”

19/06/2020
How to Stream UFC 241 Cormier vs. Miocic Live Online
Teknologi Digital

How to Stream UFC 241 Cormier vs. Miocic Live Online

19/06/2020
How to Refresh Your Google Play Music Library and Find Your Missing Tracks
Teknologi Digital

How to Refresh Your Google Play Music Library and Find Your Missing Tracks

16/06/2020
How to Skip Numbering in a Numbered List in Word
Teknologi Digital

How to Skip Numbering in a Numbered List in Word

16/06/2020
Aksesori Audio Cerdas Roku Akan Mendukung Suara Surround Nirkabel Bulan Depan
Teknologi Digital

Aksesori Audio Cerdas Roku Akan Mendukung Suara Surround Nirkabel Bulan Depan

12/02/2020
Thermostat Nest Anda Sekarang Dapat Memperingatkan Anda Tentang Potensi Masalah HVAC
Teknologi Digital

Thermostat Nest Anda Sekarang Dapat Memperingatkan Anda Tentang Potensi Masalah HVAC

12/02/2020
Cara Menggunakan Perintah grep di Linux
Teknologi Digital

Cara Menggunakan Perintah grep di Linux

01/02/2020
Next Post

What Does Liver Size Say About My Health?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Video Bokep Jepang Terbaru video bokep Jepang hot & Sexy

    Video Bokep Jepang Terbaru video bokep Jepang hot & Sexy

    0 shares
    Share 0 Tweet 0
  • FILM SEMI ROMANTIS JEPANG SUB INDO HD | banyak adegan hotnya bikin penasaran

    0 shares
    Share 0 Tweet 0
  • Film Semi Barat Terbaru Sub Indo

    15 shares
    Share 0 Tweet 0
  • Full House Murderous (满屋杀气, 2018) chinese thriller trailer

    0 shares
    Share 0 Tweet 0
  • Film semi jepang terbaru 2020 sub indo

    0 shares
    Share 0 Tweet 0
Baru & hangat

Kami menyediakan konten berita dan hiburan baru dan panas. Kunjungi situs web kami setiap hari untuk membaca berita terbaru, berita hangat, menonton film baru, mendengarkan lagu-lagu hebat, dan banyak lagi.

Hubungi kami: mediritas@gmail.com

No Result
View All Result
  • News
    • Berita Indonesia
    • Berita Dunia
  • Teknologi
    • Teknologi Digital
  • Kesehatan
    • Penyakit & Gejala
    • Nutrisi
  • Travel
    • Bepergian di Asia
    • Bepergian di Eropa
  • Review Mobil
  • Nonton Film
    • Film Laga
    • Film Fantasi
    • Film Komedi
    • Film Romantis & Cinta
    • Kartun & Anime
    • Film Horor
  • Dengerin Musik
    • Musik Populer
    • Dangdut
    • Musik Instrumental
  • Pria
    • Gadis Seksi

© 2021 JNews - Premium WordPress news & magazine theme by Jegtheme.