Shine Tutorial    
  shinetutorialtopsideimage
HOME DOS OS C,C++ HTML CSS XML JAVA ASP PHP SQL OFFICE MULTIMEDIA MORE... CERTIFICATION ABOUT
 
S T ADVT
TUTORIALS
 

MS - DOS Command

« Previous Next Chapter »

Microsoft DOS edlin command

Quick links

About edlin
Availability
Syntax
Examples

About edlin

Edlin is an early version of the MS-DOS edit command. While not as easy as the edit command, edlin allows the user to crudely edit files.

You can also use the below command to create a file (not edit).

copy con <name of file>

Once you have entered the above command, this will create the file with the name specified.
Once you have typed all the lines you wish to be in the file, press and hold CTRL + Z. This should enter ^Z, once on the screen, press the enter and one file should be copied.

Availability

The edlin command is an external command that is available in the below Microsoft operating systems.

MS-DOS 5.0 and below
Windows 95
Windows 98
Windows NT
Windows 2000
Windows XP

Syntax

EDLIN [drive:][path][filename]

[RANGE] L Displays a range of lines. If no range is specified L will list the first 23 lines of the file you are editing.
[RANGE] P Displays listing of range of lines. If no range is specified P will display the complete file. This is different from L in that P changes the current line to be the last line.
[RANGE] S [STRING] Searches the current file open for a certain string.
[RANGE], [LINE], [NUMBER] C Copies the specified range to the specified line. Number specifies how many copies to do.
[RANGE] D Deletes a certain range of lines.
[LINE] I Inserts new line at the beginning of line specified.
To save the line instead and exit out of the insert menu press <Ctrl> + Z + <Enter>
To exit out of the insertion press <Ctrl> + <C>
[RANGE], [LINE] M Moves a certain range to the specified line.
[LINE] Allows the editing of specified line.
[RANGE] R [STRING1] [STRING2] Searches the specified range for the first specified string if the string is found replaces the string with the second specified string.
[NUMBER] A Reads the number of lines into memory.
[LINE] T [DRIVE:] [\PATH] [FILE] Merges the specified file into the current document at the specified line.
[NUMBER] W Writes the specified number of lines onto disk.
Q Quits Edlin without saving changes.
E Quits Edlin after saving changes.

Windows 2000 and Windows XP syntax

EDLIN [drive:][path]filename [/B]

 /B Ignores end-of-file (CTRL+Z) characters.

Examples

The below example demonstrates the basic steps needed to edit the autoexec.bat. Below demonstration illustrates both what you would see and what you would type. What you would type is displayed in red.

EDLIN C:\AUTOEXEC.BAT

*L

The above line would display the contents of the autoexec.bat that

  we demonstrated below (contents may vary).

1: @echo off
2: cls
3: prompt $p$g
4: path=c:\dos

In the below example we choose one of the lines to edit, which in this case is line number 4. Once you have chosen a line number to edit and press enter, edlin will then display the line that you are editing with a blank line beneath it. If you press enter without typing anything, this line will not be changed. However, if you need to change the line, type the information you wish to place on this line and press enter to make the changes.

*4

4:path=c:\dos
path=c:\windows

Once we have made the above changes, ensure the changes are correct by typing L again to list the file. If the changes are correct, type E save and quit editing the autoexec.bat. However, if you do not want to save the changes, type Q and press enter to quit without saving the changes.

HELPFUL TIPS:

  • Use the ; between multiple commands to execute all commands at once.

  • Use the . in your command statements, which represents the current line. For example, 1,.,5c would copy line 1 to current line and insert the copied text before line 5.


« Previous Next Chapter »