CHAIN        Transfer control to a new script file

Top  Previous  Next

Syntax:

CHAIN

[ file name ]  |  [ /options ]

Arguments:

[ file name ]

Variable or string defining a file or path name; if no path is defined Robo-FTPs working folder is used.

Options:

&arg&

Up to nine arguments may be passed to the chained script in the same manner that they may be passed from the command line into Robo-FTP when it is launched; the first argument is saved in script variable %1, the second in %2, etc. up to %9.

 

 

Use of this script command transfers control to another script file. Unlike the CALL command, control does not return to the original script file when execution of the chained script is complete.

 

Arguments may be passed to a called script using the double ampersand syntax. Any strings found between two ampersand delimiters (ie &value&) are saved in sequence in internal variables named %1 through %9 which are then accessible within the chained to script. The following example passes two arguments.

 

CHAIN "called_script.s" &arg1& &arg2&

 

When the new script is running, it will find %1 = “arg1” and %2 = “arg2”.

 

Consider the following example where a variable named which_one has been previously populated with a value used to determine which of two script files are to be executed.

 

IFSTRCMP which_one "its2" GOTO chain_to2

DASHBOARDMSG "Launching script1.s"

CHAIN "script1.s"

:chain to2

DASHBOARDMSG "Launching script2.s"

CHAIN "script2.s"

 

 

Related Command(s): CALL, EXEC, WORKINGDIR

See also: Passing External Values Into Command Scripts