This project is read-only.

no ERRORLEVEL returned on failed transfers

Jun 16, 2011 at 11:29 AM



we scripted a filetransfer in a DOS Batch and tried to handle failed transfers correctly.

but as far as we can see it returns always ERRORLEVEL=0. When file transfers fail due to

missing rights, invalid directories or unreachable target hosts the program tells the

error cause as a text information but not in the returncode.


Is this correct?

Jun 17, 2011 at 12:43 PM


yes, the current version does not interact with the shell in terms of return codes.

I'm going to add it as a request for the next version.




[ MVP / IIS ]

Jul 1, 2011 at 6:47 PM


I verified, ftps.exe returns 0 in case of success or -1 otherwise.



Alessandro Pilotti

[ MVP / IIS ]


Jul 23, 2012 at 3:02 PM

Hello Alex,

Sorry to revive such an old thread, but it appears that if you initiate a transfer but 0 files are transferred, a return code 0 is returned as the errorlevel. We're running this via a batch file and I've verified that a -1 is returned in other circumstances (like no connection to the FTP server), so would it be possible to have a -1 returned if a transfer is initiated but no files are transferred? If not, can you think of another way to handle this situation?

Here is our ftps.exe command:

ftps.exe -h -ssl Implicit -sslInvalidServerCertHandling Accept -U MyUser -P MyPassword -p c:/myfiles/*.zip /remotepath

Here is my batch file code to catch the errorlevel:

     sendemail.exe %from% %towhom% -u Offsite SQL Transfer Successful -m "Return Code 0 Success." %server%
  ) ELSE (
    sendemail.exe %from% %towhom% -u Offsite SQL Transfer Failed! -m "Please check for failure reason." %server%