Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).
Can variables be used in script command options?
Robo-FTP 3.9 and Later
Robo-FTP 3.9 and later supports using variables for script command options. Any quoted string used as an option will be processed as a string literal. Any unquoted string used as an option will be processed as a variable if a variable exists with that name. If no variable exists with that name, the string will be processed as a string literal.
Robo-FTP 3.8.x and earlier
Robo-FTP script command options may not be specified using variables directly. However, there is a way variables may be used as options. This involves the building of a complete command in a variable and using the PERFORM script command to run it. For example, let's assume that you wish to control the reading of a text file using the READFILE command with the /record option, but the record number varies and you wish to use a variable to specify which record to read. Normally the command would look something like the following:
READFILE "datafile" datarecord /record=1
The /record option accepts a numeric constant only. Using a variable, you would like do something like:
rec = 10 READFILE "datafile" datarecord /record=rec
But this will result in a syntax error. However, the supported method would be:
SET file = "datafile" SET rec = 10 SET cmd = "READFILE" & file & " /record=" & rec PERFORM cmd
This method may be used on any Robo-FTP script command that uses options.
Article last updated: 2019-05-02
Tags: Robo-FTP, Command Line