Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

MENU MENU
Need help writing a script? Have any question about ScriptFTP?
I have a script that takes parameters. Is there a way to pass parameters to the script in the interactive environment?

In the textbox labelled "Script file", I tried

Code: Select allc:\myscript.ftp "param1" "param2"

and I get the error message

The file c:\myscript.ftp "param1" "param2" does not exist or is not accessible

I get around this by hardcoding values in the code, but it becomes a nuisance when there are a lot of parameters.

Thanks,

John
Hi John,

Yes, there is a way. And actually it is almost the way you thought it was. You just need to add ScriptFTP.exe or ScriptFTP_console.exe:

Code: Select allScriptFTP.exe the_script.ftp "the param 1" 1234321

Note that the exe files are usually under C:\Program Files(x86) \ScriptFTP

Then, in the script, you can retrieve the value of the parameters with the GETPARAM command
FTP Script
  1. $folder_path = GETPARAM(2)
  2. $remote_address = GETPARAM(3)

More info (and examples) here:
https://www.scriptftp.com/d/ftp-miscellaneous-commands/getparam