ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous WINDEV functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
CommandLine (Function)
In french: LigneCommande
Identifies and retrieves the different elements of the command line passed as a parameter to the current program.
Example
// On appelle l'exécutable avec la ligne de commande suivante :
// projet.exe param1 /opt1=param2 "param31 param32" -opt2="param41 param42"
CommandLine()	// Renvoie la totalité de la ligne de commande
LigneCommande("")    // ERREUR : LigneCommande() et LigneCommande("") ne sont pas équivalents
CommandLine(1)	// Renvoie 'param1'
CommandLine(2)	// Renvoie '/opt1 = param2'
CommandLine(3)	// Renvoie 'param31 param32'
CommandLine(4)	// Renvoie '-opt2 = "param41 param42"'
CommandLine(5)	// Renvoie ' '
CommandLine("opt1")	// Renvoie 'param2'
CommandLine("opt2")	// Renvoie 'param41 param42'
CommandLine("opt3")	// Renvoie ' '
CommandLine("opt3", "Vide")	// Renvoie 'Vide'
Syntax

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 index>)
<Result>: Character string
Parameter corresponding to the requested index.
<Option index>: Integer
Index of the option to be retrieved.
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
Name of the option to be retrieved. 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
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", "Faux")
Commands:
  • program.exe -> CommandLine returns "False".
  • program.exe /select -> CommandLine returns "False".
  • program.exe /select=abc -> CommandLine returns "abc".
Remarks
  • In test mode, you can specify the command line in the editor (on the "Project" tab, in the "Test mode" group, expand "Test mode" and select "Configure test mode").
  • Unlike CommandLine, dbgStandardOutput allows the executable to return a value to the application that started it (write operation in STDOUT).
Business / UI classification: Neutral code
Component: wd300vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Recebendo paramentros via linha comando do MS-DOS
in Project windev
Project / CODE Global Init

comando is string = CommandLine()

switch comando
case "win_clientes"
open(win_clientes)

case "win_clientes, file.json"
open(win_clientes, file.json)

case other
open(win_clientes, comando)

end


///Modo de usar

MyProjectC.exe win_clientes, file.json"
Boller
12 Apr. 2024

Last update: 05/13/2025

Send a report | Local help