SPAWN Procedure (Windows)
Spawns a child process to execute a given command.
note | Starting the PV-WAVE Home Window by directly invoking wavewin2.exe from the File Explorer or Start menu can prevent the SPAWN command from capturing output from the command. Instead, you must start the Home Window via wavewin2.bat to allow command output capture. The PV-WAVE Home Window link in the Start menu uses wavewin2.bat. |
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
For background information, see the PV‑WAVE Application Developer’s Guide.
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.