記錄文本、批次或 config.sys 檔案中的批註。 如果未指定註解,則 rem 會新增垂直間距。
Note
這個指令在命令列解釋器內部,cmd.exe。
Syntax
rem [<comment>]
Parameters
| Parameter | Description |
|---|---|
<comment> |
指定要包含為批註的字元字串。 |
| /? | 在命令提示字元中顯示說明。 |
Remarks
rem 指令不會在螢幕上顯示註解。 若要在畫面上顯示註解,您必須在檔案中包含 echo on 命令。
您無法在批次處理檔批註中使用重新導向字元(
<或>)或管道(|)。雖然您可以使用沒有註釋的 rem 來為批次檔添加垂直間距,但您也可以使用空白行。 處理批次程式時會忽略空白行。
Examples
若要透過批處理檔批註新增垂直間距,請輸入:
@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. ^)
)