<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Application functions > App > Arg* > Arg |
Description
This command scan command line searching for [ArgumentName = ArgumentVale] pairs allowing easy passing command information.
Syntax
s = App.Arg.ArgumentName
Returns
String.
Parameters
Name |
Type |
Optional |
Meaning |
ArgumentName |
Name |
No |
The name of command argument name whose Value will be returned |
Remarks
At position 0 there is always the full command line.
At position 1 there is always the full path of the script file.
Real commands start at position 2.
Restrictions
Any of the following chars are used as default command separators: " =-, (double quote, space, equal, minus, comma).
See also
Examples
'---If script command line is: env= dev, env2 = prod, xxx=1234_abc
'---app.arg.env WILL RETURN: dev
'---app.arg.env2 WILL RETURN: prod
'---app.arg.xxx WILL RETURN: 1234_abc
uses "console"
printl "argc......:", app.argc
for lCount as long = 0 to 9
printl $("argv({lCount})...:"), app.argv(lCount)
Next
PrintL
printl "env.......:", app.arg.env
printl "env2......:", app.arg.env2
printl "xxx.......:", app.arg.xxx
WaitKey(10)
Output
argc......: 11
argv(0)...: "C:\thinBasic\SampleScripts\_Test\Arg.tbasic" env= dev, env2 = prod, xxx=1234_abc
argv(1)...: "C:\thinBasic\SampleScripts\_Test\Arg.tbasic"
argv(2)...: env
argv(3)...: =
argv(4)...: dev
argv(5)...: ,
argv(6)...: env2
argv(7)...: =
argv(8)...: prod
argv(9)...: ,
env.......: dev
env2......: prod
xxx.......: 1234_abc