exit

適用於:Windows Server 2022、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012

結束命令解釋器或目前的批次指令碼。

語法

exit [/b] [<exitcode>]

參數

參數 描述
/b 結束目前的批次指令碼,而不是結束 Cmd.exe。 如果從批次指令碼外部執行,則會結束 Cmd.exe。
<exitcode> 指定數字。 如果指定 /b,則 ERRORLEVEL 環境變數會設定為該數字。 如果要結束命令解釋器,程序結束代碼會設定為該數字。
/? 在命令提示字元顯示說明。

範例

若要關閉命令解釋器,請輸入:

exit