Use the command
quit
to exit FileZilla Pro Command Line.FileZilla Pro Command Line returns an exit code to the calling process (usually the operating system shell). If the error flag (see Error Handling) is set the exit code is 0, otherwise is 1.
Also, the quit command can take a parameter to set the exit code that will be returned:
quit <exit code>
The exit code can be read by inspecting the following variables:
- On the command prompt (CMD.EXE), inspect the environment variable
%ERRORLEVEL%
- On PowerShell, inspect the variable
$LastExitCode
.Example
See the example below. The script sets the error handling to exit in case of error:
# upload.fzs
connectftp://user:password@example.net
setcli.error_handling exit
putthis_file_doesnt_exist.pdf
quitand the batch file that calls it checks the exit code:
REM run.bat
REM Batch file running FileZilla Pro CLI“C:\Program Files\FileZilla Pro CLI\fzcli.exe”
--script upload.fzs
REM Check the exit code
IF %ERRORLEVEL% EQU 0 (
echo Transfer succeeded
) ELSE IF %ERRORLEVEL% EQU 1 (
echo Transfer failed
)