Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.


launch_vbscript.s

Download

Robo-FTP integrates tightly with other processes. This example shows how to launch a VBScript file from within a Robo-FTP script.

The sample script launches the Microsoft scripting host and passes the path to the VBScript file as a command line parameter. The sample also shows how to pass additional arguments to your VBScript.

If your VBScript returns a custom exit code, Robo-FTP stores this value in the built-in variable %lasterror.


  1  ; We can execute a VBScript file by running the Miscrosoft scripting host and
  2  ; passing the path to our VBScript as a command line parameter.  We can also
  3  ; pass additional parameters from Robo-FTP into the VBScript.  Then our 
  4  ; VBScript can return a single numeric value as its exit code.
  5  
  6  ; Please verify these paths on your system:
  7  SET ScriptingHost_Path = '"c:\windows\system32\cscript.exe"'
  8  ; Above path should be c:\windows\SysWOW64\cscript.exe on 64-bit systems
  9  SET VBScript_Path = '"C:\path\to\my\vbscript.vbs"'  
 10  
 11  ; Call VBScript
 12  EXEC ScriptingHost_Path /passargs VBScript_Path
 13  
 14  ; Call VBScript with additional parameters
 15  EXEC ScriptingHost_Path /passargs VBScript_Path 1 "five"
 16  
 17  ; Call VBScript using Robo-FTP script variables instead of numeric constants
 18  SETNUM min = 5
 19  SETNUM max = 10
 20  EXEC ScriptingHost_Path /passargs VBScript_Path min max
 21  
 22  ; If VBScript sets custom exit code, Robo-FTP stores that value for use in your script
 23  DISPLAY %lasterror
 24  
 25  EXIT

Browse complete list of scripts