Edlin: s (search)

Searches for the string that you specify.




line1 : Specifies the first line you want to search.

line2 : Specifies the last line you want to search.

? : Sends a confirmation message when Edlin.exe finds the first occurrence of the string specified in string1.

string : Specifies the string for which you want to search. Do not insert a space before this parameter on the command line, unless the space is part of the search text.


Windows XP does not use this command. It is accepted only for compatibility with MS-DOS files. 

This tool is not available on Windows XP 64-Bit Edition. 

Edlin.exe displays the first line that contains an occurrence of the string. After the first occurrence is found, the search stops, and then the line that contains string becomes the current line.

Omitting parameters

If you omit line1, Edlin.exe starts the search on the line after the current line. If you omit line2, Edlin.exe stops the search at the end of the file.

If you omit string, Edlin.exe uses the most recently used of the following two values: the value that you specified for string the last time you used s , or the value that you specified for string1 the last time you used r during this session. If you omit string and you have not used the s or r subcommands during the current session, the s subcommand stops immediately.

Using the ? parameter

If you include the ? parameter in your command, Edlin.exe displays the line containing the first occurrence of the character string specified for string and prompts you by displaying the following confirmation message:

O.K.? _

If you press Y or ENTER, the line displayed before the message becomes the current line and the search stops. If you press N, the search continues until another occurrence is found or until Edlin.exe displays the following message indicating that Edlin.exe has searched all lines:

Not found


In this example, the following file is in memory and ready to edit. When you use the l (list) subcommand at the * prompt, Edlin.exe displays the contents of the file.

1: Dear Mr. Muth: 
3: Congratulations on your promotion 
4: to the position of Senior Chemical 
5: Engineer. I continue to be most 
6: impressed with your fine work. 
8: I think you will enjoy working with 
9: Mr. Lang on the new project. Please 
10: let me know if there is anything I 
11: can do to assist you. 
13: Sincerely, 
15: Clay Martin, President 

To search lines 2 through 12 for the first occurrence of the word "to," type:


Edlin.exe displays the following line:

4: to the position of Senior Chemical

To display the line containing the first occurrence of "to" and receive a confirmation message, type:


Edlin.exe displays the following lines:

4: to the position of Senior Chemical 
O.K.? _ 

If you press any key other than Y or ENTER, the search continues. For this example, press N, as follows:

O.K.? n 

Edlin.exe continues the search and displays the following lines:

5: Engineer. I continue to be most 
O.K.? _ 

Press Y to stop the search.

Formatting legend



Information that the user must supply


Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output


Edlin subcommands

Edlin: r (replace)

Command-line reference A-Z

© 2017 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy & Cookies