# MX\_NXTCMD

> [HTML Version](miamex18getnextlineofcf.htm)

_Reviewed and revised May 2024_

**xcall MIAMEX, MX\_NXTCMD, cmdline, status \{,flag\}**

MX\_NXTCMD (MIAMEX 18) returns the next line of the current command (.CMD or .DO) file in memory, with an option to preview it without actually consuming it.

**Parameters**

_cmdline_ho  ([String](string.md))  \[out\]

should be a string variable long enough to return any expected command line.

_status_  ([Integer](integer.md))  \[out\]

returns zero if there is nothing to input—i.e. no command file is currently running or its end has already been reached—else returns one.

_flag_  ([Integer](integer.md))  \[in\]

if specified and set to a non-zero value, the operation becomes "preview" or "non-destructive read", i.e. the next line is returned in _cmdline_ but the internal command line position is unchanged.

**Comments**

This function is used in the implementation of GOTO.LIT in order to skip over the command line contents up to the target label. The technique can also be useful in a case where you want to effectively abort a command file execution in response to some data or environmental condition, perhaps chaining to another command file instead.