Controller.Command Method

Executes a console command and returns the command output as a string.

... Controller.Command(command_string)

Prerequisites

None

Parameters

command_string

A required String expression. The String expression can be a String variable, constant, function or method, or a concatenation of these String elements. The value of the string is interpreted as a standard Console Command.

Remarks

This method executes the Console Command defined by the command­_string parameter. For a list of valid commands, please see the Console Command section of the PreciseFlex Library.

If the command requires additional data, the command_string must contain the command definition followed by an ASCII line-feed character (GPL constant GPL_LF, numeric value 10), followed by the additional data. Multiple lines of data may be supplied in the same manner.

This method returns a string value that contains any output generated by the command, followed by the command status. Each line of output is terminated by an ASCII line-feed character. The final line of output is always a status string, followed by a line-feed. If the command generated no output, the string value contains only the status followed by a line-feed.

The status string is an ASCII value that contains:

Be careful about issuing a command that could generate a large amount of output such as a DataLog or Type command. Such a command could consume all available free storage and cause your system to stop with "No memory available" errors.

Examples

                Dim ss As String
ss = Controller.Command("directory")
Console.WriteLine(ss)

Displays the output:

dev
ROMDISK
flash
GPL
0,"Success"

ss = Controller.Command("directory xyz")
Console.WriteLine(ss)

Displays the output:

-508,"*File not found*"

See Also

Controller Class