PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
CommandLine (Function)
In French: LigneCommande
Identifies and retrieves the different elements of the command line passed in parameter to the current program.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// The executable is called by the following command line:
// project.exe param1 /opt1=param2 "param31 param32" -opt2="param41 param42"
CommandLine() // Returns the entire command line
CommandLine(1) // Returns 'param1'
CommandLine(2) // Returns '/opt1 = param2'
CommandLine(3) // Returns 'param31 param32'
CommandLine(4) // Returns '-opt2 = "param41 param42"'
CommandLine(5) // Returns ' '
CommandLine("opt1") // Returns 'param2'
CommandLine("opt2") // Returns 'param41 param42'
CommandLine("opt3") // Returns ' '
CommandLine("opt3", "Empty") // Returns 'Empty'
Syntax
WINDEVReports and QueriesUniversal Windows 10 AppJavaUser code (UMC)

Retrieving the entire command line Hide the details

<Result> = CommandLine()
<Result>: Character string
Command line passed to the executable (without the name of the executable itself).

Retrieving the value of Nth parameter in the command line Hide the details

<Result> = CommandLine(<Option Subscript>)
<Result>: Character string
Parameter corresponding to the requested subscript.
<Option Subscript>: Integer
Subscript of option to retrieve.
Note: The space character corresponds to the separator.

Retrieving the value of a specific parameter in the command line Hide the details

<Result> = CommandLine(<Option Name> , <Default Value>)
<Result>: Character string
Value corresponding to the requested parameter.
<Option Name>: Character string (with quotes)
Name of option to retrieve. The following syntaxes are accepted:
  • /<name> = value
  • -<name> = value
The space character corresponds to the separator. To use a space in the value of a named parameter, the parameter must be enclosed in quotes ("<Parameter with space>").
Example: project.exe param1 /opt1="param2 with spaces".
<Default Value>: Character string (with quotes)
Default value returned if the option is not found or does not exist.
By default, the returned value by is an empty string ("").
Example:
CommandLine("select", "False")
Commands:
  • program.exe -> CommandLine returns "False".
  • program.exe /select -> CommandLine returns "False".
  • program.exe /select=abc -> CommandLine returns "abc".
Remarks
  • In test mode, the command line can be specified in the editor ("Project .. Test mode .. Configure the test mode").In test mode, the command line can be specified in the editor (on the "Project" pane, in the "Test mode" group, expand "Test mode" and select "Configure the test mode").
  • If CommandLine is used in a Java applet generated by WINDEV, only the syntax for "Retrieving the value of a specific parameter of the command line" is supported.
  • In a Java applet, CommandLine retrieves the parameters passed to the applet (in the <APPLET> tag for example).
  • Unlike CommandLine, dbgStandardOutput allows the executable to return a value to the application that started it (write operation in STDOUT).
Components
WINDEVReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
Java wd230java.jar
Linux wd230vm.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment