命令行大全

edlin

舞夕之 发表于 2020-06-28 17:27浏览次数:

Edlin命令是MS-DOS编辑命令的早期版本。虽然不像MS-DOS文本编辑器那样简单或精致,但Edlin确实允许用户粗略地编辑文件。

查看英文版

目录:

1 edlin 运行系统环境

2 创建文件的替代方法

3 edlin 语法

4 edlin 示例

edlin 运行系统环境

Windows 95

Windows 98

Windows xp

Windows 2000

Windows NT

MS-DOS 5.0及更低版本

创建文件的替代方法

您还可以使用以下命令创建文件(不是编辑)。

copy con

输入上述命令后,将创建一个具有指定名称的文件。

输入文件中要包含的所有行后,按住Ctrl+Z。按这些键将进入^Z,看到后按Enter键,应复制一个文件。

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

copy con

Once you have entered the command above, a file with specified name is created.

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 Enterand one file should be copied.

查看英文版

查看中文版

edlin 语法

EDLIN [drive:][path][file name]
[RANGE] L 显示一系列线。如果未指定范围,则L将列出正在编辑的文件的前23行
[RANGE] P 显示行范围列表。如果未指定范围,P将显示完整的文件。此选项与L不同,因为P将当前行更改为最后一行
[RANGE] S [STRING] 在当前打开的文件中搜索特定字符串
[RANGE], [LINE], [NUMBER] C 将指定范围复制到指定行。该数字指定要执行的复制数
[RANGE] D 删除特定范围的行
[LINE] I 在指定的行首插入新行。要保存该行并退出“插入”菜单,请按+Z+,按+退出插入
[RANGE], [LINE] M 将特定范围移动到指定行
[LINE] 允许编辑指定行
[RANGE] R [STRING1] [STRING2] 在指定范围内搜索第一个指定字符串,如果找到该字符串,则用第二个指定字符串替换该字符串
[NUMBER] A 将行数读入内存
[LINE] T [DRIVE:] [\PATH] [FILE] 将指定文件合并到当前文档的指定行处
[NUMBER] W 将指定数量的行写入磁盘
Q 退出edlin而不保存更改
E 保存更改后退出edlin
EDLIN [drive:][path][file name]
[RANGE] L Displays a range of lines. If no range is specified, L lists 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+ Z +Press+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.

查看英文版

查看中文版

edlin 示例

下面的示例演示了编辑autoexec.bat所需的基本步骤。下面的演示说明了您将看到的内容和您要键入的内容。

EDLIN C:\AUTOEXEC.BAT
*L

上面的行将显示autoexec.bat的内容,如下所示(内容可能有所不同)。

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

在下面的示例中,我们选择要编辑的一行,在本例中是第4行。选择要编辑的行号并按Enter键后,edlin将显示正在编辑的行号,行号下有一个空行。如果您在没有输入任何内容的情况下按Enter键,则此行不会更改。要进行更改,请输入要放在该行上的信息,然后按Enter键。

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

进行更改后,再次输入L键列出文件,以确保更改正确。如果更改正确,请键入E save并退出编辑autoexec.bat。但是,如果您不想保存更改,请输入Q并按Enter键退出,而不保存更改。

有用的提示:

  • 在多个命令之间使用“;”(分号)可一次执行所有命令。
  • 使用“.”(句点),它表示当前行。例如,1,.,5c会将第1行复制到当前行,并在第5行之前插入复制的文本。

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.

EDLIN C:\AUTOEXEC.BAT
*L

The line above would display the contents of the autoexec.bat that are demonstrated below (contents may vary).

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

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 is not changed. To make changes, type the information you want to place on this line and press Enter.

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

Once changes are made, ensure the changes are correct by typing Lagain 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 ";" (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.

查看英文版

查看中文版