Home > Language Reference > Program Flow Functions > Command$


The Command$ function returns the arguments used to start execution of the current script from a calling script.


Used to pass parameters from one script to another.




<argument number>, integer, constant, argument number to retrieve. The count starts at 0 and command$(0) always returns the script name.

Return value

var$, string,<argument number> content. If <argument_number> does not exist, the function returns an empty string (an empty string is "").

See also

Parameters passed from one script to another


' Script 1
    Run("script2 param1 param2")   'Runs script2.rob using 2 parameters

'Script 2
    msgbox(command$(0))  ' At execution through Script1, it displays script2, name of the calling script, including the path
    msgbox(command$(1))  ' Display param1
    msgbox(command$(2))   'Display param2


' Script 1 (the calling script)
    Program$=Script_Patht$+"called.rob "+Parm1$+" "+Parm2$

' Script 2 (the script launched by script 1 using Run function)
    a$=command$(0)   'Display the Script name
    Message$="Script name is: " + a$
   a$=command$(1)  'Display first parameter
    Message$="Parameter 1 is: " + a$
    a$=command$(2)  'Display second parameter
    Message$="Parameter 2 is: " + a$