記錄文本、批次或 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. ^)
)