Purpose:Start a console (character-mode) application in detached mode


Format:DETACH [/Q] command




commandThe name of a command to execute, including an optional drive and path specification and any parameters. The name must be enclosed in double quotes if it contains any spaces.


See also: START and TASKEND.




When you start a program with DETACH, that program cannot use the keyboard, mouse, or video display. It is "detached" from the normal means of user input and output. However, you can redirect the program's standard I/O to other devices if necessary, using redirection symbols. In most cases, you should only DETACH text-mode programs, since most graphical applications cannot run without a screen or keyboard, or have their input and output redirected.


The command can be an internal command, external command, alias, or batch file. If it is not an external command, TCC-RT will detach a copy of TCC-RT to execute the command.


Once the program has started, TCC-RT returns to the next command immediately. It does not wait for a detached program to finish.


The Process ID of the detached program is returned in the _DETACHPID variable.


You can use the TASKEND command to stop a detached program which does not terminate on its own.




The following command will detach a copy of TCC-RT to run the batch file XYZ.BTM:


detach xyz.btm


You can also include any parameters or command line switches which the command knows how to interpret:


detach "xyz.btm Monday Nebraska"


If you prefer, you can use the Linux syntax of putting a trailing & on the command line instead of specifying DETACH. (TCC-RT will convert it to DETACH before executing the command.)


xyz.btm &




/QDon't display the new process's ID.