|Original author(s)||Tim Paterson|
|Operating system||DOS, MS-DOS, OS/2, Microsoft Windows|
Edlin is a line editor, and the only text editor provided with early versions of MS-DOS. Although superseded in MS-DOS 5.0 and later by the full-screen edit command, and by Notepad in Microsoft Windows, it continues to be included in the 32-bit versions of current Microsoft operating systems.
Microsoft acquired 86-DOS and sold it as MS-DOS, so Edlin was included in v1.0 - v5.0 or MS-DOS - after which the only included editor was the new full-screen EDIT.EXE in v6.0 - v8.0.
Early Windows versions ran on top of the later versions of MS-DOS, so Edlin was typically not available.
However, Edlin is included in the 32-bit versions of Windows NT and its derivatives - up to and including Windows 8 - because the NTVDM's DOS support in those operating systems is based on MS-DOS version 5.0. However, unlike most other external DOS commands, it has not been transformed into a native Win32 program. It also does not support long filenames, which were only added to MS-DOS and MS-Windows long after Edlin was written.
There are only a few commands. The short list can be found by entering a ? at the edlin prompt.
When a file is open, typing L will list the contents. E.g.:
1,6L to view lines 1 through 6. Each line will be displayed with a line number in front of it.
*1,6L 1: Edlin: The only text editor in early versions of DOS. 2: 3: Back in the day, I remember seeing web pages 4: branded with a logo at the bottom: 5: "This page created in edlin." 6: The things that some people put themselves through. ;-) *
The currently selected line will have a *. To replace the contents of any line, the line number is entered and any text entered replaces the original. While editing a line pressing Ctrl-C will cancel any changes. The * marker will remain on that line.
Entering I (optionally preceded with a line number) will insert one or more lines before the * line or the line given. When finished entering lines, Ctrl-C will return to the edlin command prompt.
*6I 6:*(...or similar) 7:*^C *7D *L 1: Edlin: The only text editor in early versions of DOS. 2: 3: Back in the day, I remember seeing web pages 4: branded with a logo at the bottom: 5: "This page created in edlin." 6: (...or similar) *
- D - will delete the specified line, again optionally starting with the number of a line, or a range of lines. E.g.:
2,4dwill delete lines 2 through 4. In the above example, line 7 was deleted.
- R - is used to replace all occurrences of a piece of text in a given range of lines, for example, to replace a spelling error. Including the ? will prompt for each change. E.g.: To replace 'prit' with 'print' and to prompt for each change:
?rprit^Zprint(the ^Z represents pressing CTRL-Z). It is case-sensitive.
- S - will search for given text. It is used in the same way as replace, but without the replacement text. A search for 'apple' in the first 20 lines of a file, would be typed
1,20?sapple(no space, unless that is part of the search) and press enter. For each match, it will ask if it the correct one, and accept n or y (or Enter).
- P - displays listing of range of lines. If no range is specified. P will display the complete file from the * to the end. This is different from L in that P changes the current line to be the last line in the range.
- T - is used to transfer another file into the one being edited, with this syntax: [line to insert at]t[full path to file].
- W - (write) will save the file.
- E - will save and quit.
- Q - will quit without saving.
Edlin may be used as a non-interactive file editor in scripts by redirecting a series of edlin commands.
edlin < script
FreeDOS Edlin 
See also