COMMAND (return command line)

Top  Previous  Next

 

COMMAND( [ flag ] )

COMMAND

Returns command line parameters.

flag

A string constant or variable containing the parameter for which to search, or the number of the command line parameter to return. If omitted or an empty string (''), all command parameters are returned as entered on the command line, appended to a leading space.

The COMMAND procedure returns the value of the flag parameter from the command line. If the flag is not found, COMMAND returns an empty string. If the flag is multiply defined, only the first occurrence encountered is returned.

COMMAND searches the command line for flag=value and returns value. There must be no blanks between flag, the equal sign, and value. The returned value terminates at the first comma or blank space. If a blank or comma is desired in a command line parameter, everything to the right of the equal sign must be enclosed in double quotes (flag="value").

COMMAND will also search the command line for a flag containing a leading slash (/). If found, COMMAND returns the value of flag without the slash. If the flag only contains a number, COMMAND returns the parameter at that numbered position on the command line. A flag of '0' returns the minimum path the operating system used to find the command. This minimum path always includes the command (without command line parameters) but may not include the path (if the operating system found it in the current directory). A flag containing '1' returns the first command line parameter. The COMMAND search is not case sensitive.

Return Data Type:

STRING

Example:

IF COMMAND('/N')              !Was /N on the command line?

DO SomeProcess

END

IF COMMAND('Option') = '1'    !Was Option=1 on the command line?

DO OneProcess

END

CommandString = COMMAND('')   !Get all command parameters

CommandItself = COMMAND('0')  !Get the command itself

SecondParm = COMMAND('2')     !Get second parameter from command line

 

See Also:

SETCOMMAND