ProgramParameter()

Syntax

Result$ = ProgramParameter([Index])
Description
Gets the next parameter string that was passed to the executable when it was launched.

Parameters

Index (optional) If specified, the parameter for that index will be returned. The first parameter index starts from 0.

Return value

The next parameter value, or an empty string if no more parameters are found. If index is specified it will return the specified parameter value.

Remarks

This function is especially useful for console programs, where the user passes one or more parameter at the program start.

Note: Relying on the return of an empty string to detect the last parameter is not a good practice, since the function also returns an empty string if an empty string was passed in "" on the command-line. The prefered method which should be used to get all parameters, is to get the count with CountProgramParameters() and then to call ProgramParameter() as often as needed.

To check the behaviour of this function, or do several tests, please read the 'Executable command-line' paragraph in the page IDE Compiler options.

Example

  MyProgram.exe MyText.txt /FAST "Special Mode"
The first time that ProgramParameter() is called, it will return "MyText.txt", the second time "/FAST" and the third time "Special Mode".

Supported OS

All

<- ProgramID() - Process Index - ProgramRunning() ->