记录脚本、批处理或 config.sys 文件中的注释。Records comments in a script, batch, or config.sys file. 如果未指定任何注释,则 rem 将增加垂直间距。If no comment is specified, rem adds vertical spacing.


rem [<comment>]


参数Parameter 说明Description
<comment> 指定要包含为注释的字符串。Specifies a string of characters to include as a comment.
/?/? 在命令提示符下显示帮助。Displays help at the command prompt.


  • Rem命令不在屏幕上显示注释。The rem command doesn't display comments on the screen. 若要在屏幕上显示注释,必须在文件中包括 echo on 命令。To display comments on the screen, you must include the echo on command in your file.

  • 不能 < 在批处理文件注释中使用重定向字符 (或 >) 或管道 (|) 。You can't use a redirection character (< or >) or pipe (|) in a batch file comment.

  • 尽管可以使用不带注释的 rem 来向批处理文件添加垂直间距,但也可以使用空行。Although you can use rem without a comment to add vertical spacing to a batch file, you can also use blank lines. 处理批处理程序时,将忽略空白行。Blank lines are ignored when a batch program is processed.


若要通过批处理文件注释来添加垂直间距,请键入:To add vertical spacing through batch file comments, type:

@echo off
rem  This batch program formats and checks new disks.
rem  It is named Checknew.bat.
rem echo Insert new disk in Drive B.
format b: /v chkdsk b:

若要在 config.sys 文件中的 prompt 命令之前包含解释性注释,请键入:To include an explanatory comment before the prompt command in a config.sys file, type:

rem Set prompt to indicate current directory
prompt $p$g

若要提供有关脚本功能的注释,请键入:To provide a comment about what a script does, type:

rem The commands in this script set up 3 drives.
rem The first drive is a primary partition and is
rem assigned the letter D. The second and third drives
rem are logical partitions, and are assigned letters
rem E and F.
create partition primary size=2048
assign d:
create partition extended
create partition logical size=2048
assign e:
create partition logical
assign f:

其他参考Additional References