Microsoft DOS edlin command
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 following 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 want to be in the file, press and hold Ctrl+Z. Pressing these keys will enter ^Z, once seen press Enter and one file should be copied.
The edlin command is an external command that is available in the below Microsoft operating systems. In MS-DOS 4.x and earlier edlin.com was used as the external file. In MS-DOS 5 and versions of Windows that supported the command edlin.exe was used as the external file.
EDLIN [drive:][path][file name]
|[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 displays the complete file. This option 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. The 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>
Press <Ctrl> + <C> to exit out of the insertion.
|[RANGE], [LINE] M||Moves a certain range to the specified line.|
|[LINE]||Allows the editing of the 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]file name [/B]
/B Ignores end-of-file (Ctrl+Z) characters.
The example below 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 type is displayed in red.
The above line would display the contents of the autoexec.bat that are demonstrated below (contents may vary).
1: @echo off
3: prompt $p$g
In the example below, 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 want to place on this line and press Enter to make the changes.
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.
- Use the ";" (semicolon) between multiple commands to execute all commands at once.
- Use the "." (period) 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.
- See our edit definition for further information and related links on this term.