DOSKEY
(doskey)
编辑命令行,重调用 MS-DOS 命令,并创建宏。
DOSKEY
[/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
[/HISTORY] [/INSERT | /OVERSTRIKE]
[/EXENAME=exename] [/MACROFILE=filename]
[macroname=[text]]
/REINSTALL
安装一组新的
Doskey。
/LISTSIZE=size 设置命令历史记录的缓冲区大小。
/MACROS
显示所有 Doskey 宏。
/MACROS:ALL
为具有 Doskey 宏的执行文件,显示所有的Doskey 宏。
/MACROS:exename 显示指定执行文件的所有 Doskey 宏。
/HISTORY
显示保存在内存中的所有命令。
/INSERT
指定用键入的新文字插入旧文字中。
/OVERSTRIKE
指定新文字改写旧文字。
/EXENAME=exename 指定执行文件。
/MACROFILE=filename 指定安装的宏文件。
macroname
指定所创建宏的名称。
text
指定要登记的命令。
使用上下箭头键选择命令;ESC 清除命令行;F7 显示命令历史记录;ALT+F7 清除命令历史记录;F8 搜索命令历史记录;F9 按编号选择命令;ALT+F10 清除宏定义。
以下是 Doskey
宏定义的特殊码:
$T 命令分隔符号。允许一个宏可以含多个命令。
$1-$9 批处理参数。与批处理程序中的 %1-%9 相同。
$* 以命令行中命令名称后面的任何内容替换的符号。
★★★★★实例★★★★★:
开关项/MACROS和/HISTORY可用于创建批处理程序,保在宏和命令。例如,创建一个包括所有Doskey宏目名为MACINIT.BAT的批处理程序,可输入下面一条命令:
doskey /macros > macinit.bat
要想使用MACINIT.BAT文件,需对该文件进行编辑,以便每个宏前都有一DOSKEY命令。
要创建一个包含最近用过的所有命令的批处理程序(假定程序名为TMP.BAT),可输入下面一条命令:
doskey /history > tmp.bat
要定义一个具有多条命令的宏,可用$T分隔命令:
dosey tx=cd\tmep$dir/w$*
在上面的例子中,宏TX把当前目录定为TEMP,然后采用宽行显示格式显示目录清单。宏的末尾加上$*,在运行该宏时就可以再添加其它开关项。
下面的宏对于新目录名使用了批处理参数。该宏首先创建一个新目录,然后将其切换为当前目录:
doskey mc=md
$1$tcd $1
使用前面的宏创建并切换到一个名为BOOKS的目录,键入以下命令:
mc books
为创建一个使用批处理参数移动文件或文件组的宏,键入下面的命令:
doskey mv=copy
$1 $2 $t
为创建一个导致MEM命令在每屏后暂停的宏,键入下面的命令:
doskey mem=mem $* /p
Edits
command lines, recalls Windows XP commands, and creates macros.
DOSKEY
[/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
[/HISTORY] [/INSERT | /OVERSTRIKE]
[/EXENAME=exename] [/MACROFILE=filename]
[macroname=[text]]
/REINSTALL
Installs a new copy of Doskey.
/LISTSIZE=size Sets size of
command history buffer.
/MACROS
Displays all Doskey macros.
/MACROS:ALL
Displays all Doskey macros for all executables
which have Doskey macros.
/MACROS:exename Displays all Doskey macros for the given executable.
/HISTORY
Displays all commands stored in memory.
/INSERT
Specifies that new text you type is inserted in old text.
/OVERSTRIKE Specifies
that new text overwrites old text.
/EXENAME=exename Specifies the executable.
/MACROFILE=filename Specifies a file of
macros to install.
macroname
Specifies a name for a macro you create.
text
Specifies commands you want to record.
UP
and DOWN ARROWS recall commands; ESC clears command line; F7 displays command
history; ALT+F7 clears command history; F8 searches command history; F9 selects
a command by number; ALT+F10 clears macro definitions.
The
following are some special codes in Doskey macro
definitions:
$T
Command separator. Allows multiple commands in a macro.
$1-$9 Batch
parameters. Equivalent
to %1-%
$*
Symbol replaced by everything following macro name on command line.