SPAWN Procedure (Windows)

Spawns a child process to execute a given command.

Usage

SPAWN[, command[, result]]

Input Parameters

command—(optional) The name of the command to spawn.

If present, must be of type string and must be a scalar.

If not present, starts an interactive shell in a new Command window and PV‑WAVE execution suspends until the new Command window is closed.

Output Parameters

result—(optional) Indicates where the result is to be directed.

If present, places the output from the child process into a string array (one line of output per array element).

If not present, sends the output from the child shell process to the standard output stream. The standard output stream is either the new Command window if one was created or the current Command window.

Keywords

Console—If present and nonzero, a new Command window is created and all input and output is directed through the new Command window. This parameter is ignored when the output parameter result is specified. The default is to create the new Command window.

Note:

No keyboard input can be directed to the spawned child process unless a new Command window has been created.

Count—The number of string elements returned if the output is a string variable.

Noshell—If present and nonzero, specifies that command should execute directly as a child process without an intervening shell process. In this case, command must be specified as a string in which the first element is the name of the command to execute and the following tokens are the parameters to be passed to the command. The command that is executed with the Noshell option cannot be a command that itself creates a shell, such as dir.

Noshell is useful when performing many spawned operations from a program and speed is a primary concern. Since no shell is present, wildcard characters are not expanded, and other tasks normally performed by the shell do not occur.

Nowait—If set, causes the calling process to continue executing in parallel with the subprocess. Otherwise, the calling process waits until the subprocess completes.

Example

SPAWN, 'dir'

See Also

CD,  LINKNLOAD

For background information, see the PV‑WAVE Application Developer’s Guide.