Post a reply :: Support Forum

Message body

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(max 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Topic review

Author Message
Looks OK.
WinSCP returns only 0 (on success) or 1 (on error).
Can you post your script and command you use to run WinSCP.
In the batch file executing the WinSCP script, there is the following line:

IF %ErrorLevel% GTR 0 (
SET Errmsg="Failed to FTP File"

On further investigation, I have realized that some Windows level errors (e.g. probably file does not exist) are returned with negative code. The Windows script fragment above does not catch negative error codes.

In order to catch negative error codes, I changed the above test to
IF %ErrorLevel% NEQ 0 (
SET Errmsg="Failed to FTP File"

So are you able to reproduce the problem with error code? If you are I can send you a debug version. Btw, how do you check for error code?
I have been running WinSCP in scripting mode from a Windows batch file on a Windows 2003 server. I got into a situation where the Put operation complained about not finding the file to transfer, but I still did not get any Windows level error code back.
ftp log file:
batch on
confirm off
Searching for host...
Connecting to host...
Using username "user1".
Authenticating with pre-entered password.
Starting the session...
Reading remote directory...
Session started.
Active session: [1]
D:\eMDR\Outbound\EES\JNJ-ZZFDATST-CDRH-AERS-3500A-1012200915243-1-3OIT7E.xml | 0 KiB | 0.0 KiB/s | binary | 0%
File or folder 'D:\eMDR\Out\EES\JNJ-ZZFDATST-CDRH-AERS-3500A-1012200915243-1-3OIT7E.xml' does not exist.
System Error. Code: 2.

The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
As you see, the log file had an error code, but it did not get propagated onto the Windows batch file level.
The same script was properly running (returning no error code with successful run, returning error code with failed run) on the same server like about 60 times previously.
I would appreciate if you could reply ASAP.




What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License