雷姆

记录脚本、批处理或 config.sys 文件中的注释。 如果未指定注释,rem 添加垂直间距。

注释

此命令在命令行解释器内部,cmd.exe。

语法

rem [<comment>]

参数

参数 说明
<comment> 指定要作为注释包含的字符字符串。
/? 在命令提示符下显示帮助。

注解

  • rem 命令不会在屏幕上显示批注。 若要在屏幕上显示批注,必须在文件中的 命令中包含 回显。

  • 不能在批处理文件注释中使用重定向字符(<>)或管道(|)。

  • 尽管可以使用 rem 而不添加批注来向批处理文件添加垂直间距,但也可以使用空白行。 处理批处理程序时,将忽略空白行。

例子

若要通过批处理文件注释添加垂直间距,请键入:

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

若要在 config.sys 文件中 提示 命令之前包括解释性注释,请键入:

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

若要提供有关脚本执行的作的注释,请键入:

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:

对于多行注释,请使用条件执行:

  Rem/||(
    The REM statement evaluates to success,
    so these lines will never be executed.
    Keep in mind that you will need to escape closing parentheses
    within multi-line comment blocks like shown in this example. ^)
  )