Post a reply :: Support Forum

Username
Subject
Message body
Options

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)
Options
 

Topic review

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

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

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"
GOTO ERROR
)

Kati
martin
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?
kmolnar@its.jnj.com
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...
Authenticating...
Using username "user1".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user1@jnj.com
/opt/cyc/common/data/out/EES/JNJ/CDRH_AERS
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.

Thanks,

Kati

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License