文章目录
- 1.Echo : 显示信息,或将命令回显打开或关上。
- 2.Edit : 启动MS-DOS编辑器,它创建和更改ASCII文本文件。
- 3.Endlocal : 结束批处理文件中环境更改的本地化...
- 4.Erase :和del用法相同。
- 5.Evntcmd : Configures the translation of events to traps, trap destinations, or both based on information in a configuration file
- 6.Eventcreate : 使管理员能够在指定的事件日志中创建自定义事件.
- 7.Eventquery : 已弃用。
- 8.Eventtriggers : 已弃用。
- 9.Exit : 退出Cmd.exe程序(命令解释程序)或当前批处理脚本。
- 10.Expand : 展开一个或多个压缩文件。
- 11.extract :解压。
1.Echo : 显示信息,或将命令回显打开或关上。
适用于:Windows Server 2008,Windows Vista
显示信息,或将命令回显打开或关上。
ECHO [ON | OFF]
ECHO [message]
要显示当前回显设置,键入不带参数的 ECHO。
eg
要防止批处理文件中的所有命令(包括echo off命令)显示在屏幕上,请在批处理文件的第一行键入:
@echo off
您可以将echo命令用作if语句的一部分。例如,要在当前目录中搜索具有.rpt文件扩展名的任何文件,并在找到此类文件时回显消息,请键入:
if exist *.rpt echo The report has arrived.
以下批处理文件在当前目录中搜索具有.txt文件扩展名的文件,并显示一条指示搜索结果的消息:
@echo off
if not exist *.txt (
echo This directory contains no text files.
) else (
echo This directory contains the following text files:
echo.
dir /b *.txt
)
如果在运行批处理文件时未找到.txt文件,则会显示以下消息:
This directory contains no text files.
如果在运行批处理文件时找到.txt文件,则显示以下输出(对于此示例,假设存在文件File1.txt,File2.txt和File3.txt):
This directory contains the following text files:
File1.txt
File2.txt
File3.txt
2.Edit : 启动MS-DOS编辑器,它创建和更改ASCII文本文件。
适用于:Windows Server 2008
启动MS-DOS编辑器,它创建和更改ASCII文本文件。
3.Endlocal : 结束批处理文件中环境更改的本地化…
适用于:Windows Server 2008,Windows Vista
结束批处理文件中环境更改的本地化,并在运行相应的setlocal命令之前将环境变量恢复为其值。
您可以在批处理文件中本地化环境变量。例如,以下程序启动网络上的superapp批处理程序,将输出定向到文件,并在记事本中显示该文件:
@echo off
setlocal
path=g:\programs\superapp;%path%
call superapp>c:\superapp.out
endlocal
start notepad c:\superapp.out
4.Erase :和del用法相同。
和del用法相同。
5.Evntcmd : Configures the translation of events to traps, trap destinations, or both based on information in a configuration file
How to forward Windows Events as Trap to LoriotPro
适用于:Windows Server 2008 R2
Configures the translation of events to traps, trap destinations, or both based on information in a configuration file.
6.Eventcreate : 使管理员能够在指定的事件日志中创建自定义事件.
适用于:Windows Server 2008
7.Eventquery : 已弃用。
8.Eventtriggers : 已弃用。
9.Exit : 退出Cmd.exe程序(命令解释程序)或当前批处理脚本。
EXIT [/B] [exitCode]
/B 指定要退出当前批处理脚本而不是 CMD.EXE。如果从一个
批处理脚本外执行,则会退出 CMD.EXE
exitCode 指定一个数字号码。如果指定了 /B,将 ERRORLEVEL
设成那个数字。如果退出 CMD.EXE,则用那个数字设置
过程退出代码。
10.Expand : 展开一个或多个压缩文件。
适用于:Windows 7,Windows Server 2003,Windows Server 2003 R2,Windows Server 2008,Windows Server 2008 R2,Windows Vista,Windows XP
展开一个或多个压缩文件。
EXPAND [-R] Source Destination
EXPAND -R Source [Destination]
EXPAND -I Source [Destination]
EXPAND -D Source.cab [-F:Files]
EXPAND Source.cab -F:Files Destination
-R 重命名展开的文件。
-I 重命名展开的文件但忽略目录结构。
-D 显示来源中的文件列表。
Source 源文件规格。可使用通配字符。
-F:Files 从 .CAB 文件展开的文件的名称。
Destination 目标文件 | 路径规格。
目标可以是目录。
如果来源是多个文件且没有指定 -r,目标则必须是目录。
11.extract :解压。
适用于:Windows Server 2008
解压。
EXTRACT [/Y] [/A] [/D | /E] [/L dir] cabinet [filename …]
EXTRACT [/Y] source [newname]
EXTRACT [/Y] /C source destination
dows Server 2008
解压。
EXTRACT [/Y] [/A] [/D | /E] [/L dir] cabinet [filename …]
EXTRACT [/Y] source [newname]
EXTRACT [/Y] /C source destination