Using the %installdir and %installver Variables

Top  Previous  Next

 

The %installdir and %installver variables are useful when designing command scripts to be run in disparate Robo-FTP environments.

 

Script developers targeting multiple computers may find the %installdir internal variable helpful because it contains the complete path of Robo-FTP's installation folder.  For example, a script that reads and writes to files in Robo-FTP's installation directory could use the %installdir variable instead of a hard-coded path.  Such a script could run without modification on both 32-bit servers where Robo-FTP is typically installed in a folder named "Program Files" and also on a 64-bit server where it is typically installed in a folder named "Program Files (x86)" instead.

 

The current installed version of Robo-FTP is available via the %installver internal variable. This variable is useful when developing scripts that behave differently depending on the current version of Robo-FTP.  Consider the following example that does not use the FTPLOGON command's /pasv option when the current version of Robo-FTP is 3.7 or newer:

 

; Get the major release number and remove the leading "v" character

setextract major = %installver "." 1

SETLEN majorLEN = major

DEC majorLEN

SETRIGHT major = major majorLEN

 

; Get the minor release number

SETEXTRACT minor = %installver "." 2

 

; Concatenate major and minor number as strings

SET ver = major & minor

 

; Numerical comparison.  Use new logon command if # > 37

IFNUM>= ver 37 GOTO new_logon

FTPLOGON "HomeOffice" /pasv

GOTO move_files

 

:new_logon

FTPLOGON "HomeOffice"

 

:move_files

SENDFILE "readme.txt" /delete

 

The format of %installver includes a leading "v" character: v[major].[minor].[build].[revision]

 

See Also: Internal Script Variables