Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

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

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

Options

Topic review

Camialra

ExitCode1

The problem was that WinSCP didnt create a directory by the server and via code the application did force the directories after the shell was excecuted, thats the reason the second time everything went right.
Camialra

ExitCode1

What I try to show is that the first time I run one directory, I always receive ExitCode1 the second time I try to run the same directory it just succeed, Since I am working in a workflow with automatization, I cannot afford to mannually set every directory twice.
I have read a post from 2009 where the problem was related to the writing to the ini file. I've tried to test those changes, configurating the ini file as only read, and changing the order of the "option batch on" and "option batch abort", and it doesnt work.
Do you know a little bit more of the solution of this problem since we are 9 years later.
martin

Re: ExitCode1

Camialra wrote:


FIRST TIME:

X:\Projecten\FTP00000050558\FTP00000050558.winscp Script generated successfully
X:\Projecten\FTP00000050558\FTP00000050558.winscp deleted OK

This is not WinSCP log. I do not know what that is.
Camialra

Re: ExitCode1

martin wrote:

Please attach a full session log file of both runs (using the latest version of WinSCP).


FIRST TIME:

X:\Projecten\FTP00000050558\FTP00000050558.winscp Script generated successfully
X:\Projecten\FTP00000050558\FTP00000050558.winscp deleted OK

SECOND TIME:

X:\Projecten\FTP00000050558\FTP00000050558.winscp Script generated successfully
Connection succeed
. 2017-07-14 11:15:14.988 --------------------------------------------------------------------------
. 2017-07-14 11:15:15.004 WinSCP Version 5.9.1 (Build 6885) (OS 6.1.7601 Service Pack 1 - Windows 7 Enterprise)
. 2017-07-14 11:15:15.004 Configuration: nul
. 2017-07-14 11:15:15.004 Log level: Normal
. 2017-07-14 11:15:15.004 Process ID: 142536
. 2017-07-14 11:15:15.004 Command-line: "P:\Applic\Resources\WinSCP\WinSCP.exe" /console=591 /consoleinstance=_140864_24 "/log=X:\Projecten\Software\logs\FTP00000050558\FTP00000050558_20170714111513_WinSCP_uploadFTP_WINSCP.log" "/loglevel=0" "/ini=nul" "/script=X:\Projecten\FTP00000050558\FTP00000050558.winscp"
. 2017-07-14 11:15:15.004 Time zone: Current: GMT+2, Standard: GMT+1 (West-Europa (standaardtijd)), DST: GMT+2 (West-Europa (zomertijd)), DST Start: 26-3-2017, DST End: 29-10-2017
. 2017-07-14 11:15:15.004 Login time: vrijdag 14 juli 2017 11:15:15
. 2017-07-14 11:15:15.004 --------------------------------------------------------------------------
. 2017-07-14 11:15:15.004 Script: Retrospectively logging previous script records:
> 2017-07-14 11:15:15.004 Script: option batch abort
< 2017-07-14 11:15:15.004 Script: batch abort
< 2017-07-14 11:15:15.004 Script: reconnecttime 120
> 2017-07-14 11:15:15.004 Script: option confirm off
< 2017-07-14 11:15:15.004 Script: confirm off
> 2017-07-14 11:15:15.004 Script: open XX
. 2017-07-14 11:15:15.004 --------------------------------------------------------------------------
. 2017-07-14 11:15:15.004 Session name: XX (Ad-Hoc site)
. 2017-07-14 11:15:15.004 Host name: XX(Port: 22)
. 2017-07-14 11:15:15.004 User name: XX(Password: No, Key file: Yes)
. 2017-07-14 11:15:15.004 Tunnel: No
. 2017-07-14 11:15:15.004 Transfer Protocol: SFTP
. 2017-07-14 11:15:15.004 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2017-07-14 11:15:15.004 Disable Nagle: No
. 2017-07-14 11:15:15.004 Proxy: None
. 2017-07-14 11:15:15.004 Send buffer: 262144
. 2017-07-14 11:15:15.004 SSH protocol version: 2; Compression: No
. 2017-07-14 11:15:15.004 Bypass authentication: No
. 2017-07-14 11:15:15.004 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2017-07-14 11:15:15.004 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-07-14 11:15:15.004 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2017-07-14 11:15:15.004 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2017-07-14 11:15:15.004 Simple channel: Yes
. 2017-07-14 11:15:15.004 Return code variable: Autodetect; Lookup user groups: Auto
. 2017-07-14 11:15:15.004 Shell: default
. 2017-07-14 11:15:15.004 EOL: LF, UTF: Auto
. 2017-07-14 11:15:15.004 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2017-07-14 11:15:15.004 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-07-14 11:15:15.004 SFTP Bugs: Auto,Auto
. 2017-07-14 11:15:15.004 SFTP Server: default
. 2017-07-14 11:15:15.004 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-07-14 11:15:15.019 Cache directory changes: Yes, Permanent: Yes
. 2017-07-14 11:15:15.019 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2017-07-14 11:15:15.019 DST mode: Unix
. 2017-07-14 11:15:15.019 --------------------------------------------------------------------------
. 2017-07-14 11:15:15.019 Looking up host "XX" for SSH connection
. 2017-07-14 11:15:15.035 Connecting to XX port 22
. 2017-07-14 11:15:15.035 We claim version: SSH-2.0-WinSCP_release_5.9.1
. 2017-07-14 11:15:15.051 Server version: SSH-2.0-srtSSHServer_10.00
. 2017-07-14 11:15:15.051 We believe remote version has SSH-2 channel request bug
. 2017-07-14 11:15:15.051 Using SSH protocol version 2
. 2017-07-14 11:15:15.051 Have a known host key of type rsa2
. 2017-07-14 11:15:15.051 Doing Diffie-Hellman group exchange
. 2017-07-14 11:15:15.285 Doing Diffie-Hellman key exchange with hash SHA-1
. 2017-07-14 11:15:15.441 Host key fingerprint is:
. 2017-07-14 11:15:15.441 ssh-rsa 2048 fb:0d:68:cc:15:07:e7:06:b5:8b:53:65:66:79:1c:7c
. 2017-07-14 11:15:15.456 Verifying host key XX
. 2017-07-14 11:15:15.456 Host key matches configured key
. 2017-07-14 11:15:15.456 Initialised AES-256 CBC client->server encryption
. 2017-07-14 11:15:15.456 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-07-14 11:15:15.456 Initialised AES-256 CBC server->client encryption
. 2017-07-14 11:15:15.456 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-07-14 11:15:15.675 Reading key file "P:\Applic\XX"
! 2017-07-14 11:15:15.721 Using username "XX".
. 2017-07-14 11:15:15.721 Server offered these authentication methods: publickey
. 2017-07-14 11:15:15.721 Offered public key
. 2017-07-14 11:15:15.753 Offer of public key accepted
! 2017-07-14 11:15:15.753 Authenticating with public key "XX"
. 2017-07-14 11:15:15.877 Sent public key signature
. 2017-07-14 11:15:15.924 Access granted
. 2017-07-14 11:15:15.924 Opening session as main channel
. 2017-07-14 11:15:15.924 Opened main channel
. 2017-07-14 11:15:16.158 Started a shell/command
. 2017-07-14 11:15:16.158 --------------------------------------------------------------------------
. 2017-07-14 11:15:16.158 Using SFTP protocol.
. 2017-07-14 11:15:16.158 Doing startup conversation with host.
> 2017-07-14 11:15:16.158 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-07-14 11:15:16.174 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2017-07-14 11:15:16.174 SFTP version 3 negotiated.
. 2017-07-14 11:15:16.174 We believe the server has signed timestamps bug
. 2017-07-14 11:15:16.174 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2017-07-14 11:15:16.174 Getting current directory name.
. 2017-07-14 11:15:16.174 Getting real path for '.'
> 2017-07-14 11:15:16.174 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2017-07-14 11:15:16.392 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2017-07-14 11:15:16.392 Real path is '/'
. 2017-07-14 11:15:16.392 Startup conversation with host finished.
< 2017-07-14 11:15:16.392 Script: Active session: [1] XX
> 2017-07-14 11:15:16.392 Script: put "X:\Projecten\FTP00000050558\*.*" /
. 2017-07-14 11:15:16.392 Copying 1 files/directories to remote directory "/"
. 2017-07-14 11:15:16.392 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2017-07-14 11:15:16.392 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2017-07-14 11:15:16.392 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2017-07-14 11:15:16.408 File: 'X:\Projecten\FTP00000050558\6478370_PDOL_batchimport20170714_111239.zip' [2017-07-14T09:12:43.484Z] [4131266]
. 2017-07-14 11:15:16.408 Copying "X:\Projecten\FTP00000050558\6478370_PDOL_batchimport20170714_111239.zip" to remote directory started.
. 2017-07-14 11:15:16.408 Binary transfer mode selected.
. 2017-07-14 11:15:16.408 Checking existence of file.
> 2017-07-14 11:15:16.408 Type: SSH_FXP_LSTAT, Size: 61, Number: 263
< 2017-07-14 11:15:16.423 Type: SSH_FXP_STATUS, Size: 32, Number: 263
< 2017-07-14 11:15:16.423 Status code: 2
. 2017-07-14 11:15:16.423 Checking existence of partially transfered file.
> 2017-07-14 11:15:16.423 Type: SSH_FXP_LSTAT, Size: 70, Number: 519
< 2017-07-14 11:15:16.423 Type: SSH_FXP_STATUS, Size: 32, Number: 519
< 2017-07-14 11:15:16.423 Status code: 2
. 2017-07-14 11:15:16.423 Opening remote file.
> 2017-07-14 11:15:16.423 Type: SSH_FXP_OPEN, Size: 86, Number: 771
< 2017-07-14 11:15:16.439 Type: SSH_FXP_HANDLE, Size: 17, Number: 771
> 2017-07-14 11:15:16.455 Type: SSH_FXP_WRITE, Size: 32797, Number: 1286
. 2017-07-14 11:15:16.735 222 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2017-07-14 11:15:16.735 Type: SSH_FXP_CLOSE, Size: 17, Number: 30980
< 2017-07-14 11:15:16.735 Type: SSH_FXP_STATUS, Size: 19, Number: 28678
< 2017-07-14 11:15:16.735 Type: SSH_FXP_STATUS, Size: 19, Number: 28934
< 2017-07-14 11:15:16.735 Type: SSH_FXP_STATUS, Size: 19, Number: 29190
< 2017-07-14 11:15:16.735 Type: SSH_FXP_STATUS, Size: 19, Number: 29446
< 2017-07-14 11:15:16.751 Type: SSH_FXP_STATUS, Size: 19, Number: 29702
< 2017-07-14 11:15:16.751 Type: SSH_FXP_STATUS, Size: 19, Number: 29958
< 2017-07-14 11:15:16.751 Type: SSH_FXP_STATUS, Size: 19, Number: 30214
< 2017-07-14 11:15:16.751 Type: SSH_FXP_STATUS, Size: 19, Number: 30470
< 2017-07-14 11:15:16.767 Type: SSH_FXP_STATUS, Size: 19, Number: 30726
< 2017-07-14 11:15:16.767 Type: SSH_FXP_STATUS, Size: 19, Number: 30980
< 2017-07-14 11:15:16.767 Status code: 0
> 2017-07-14 11:15:16.767 Type: SSH_FXP_RENAME, Size: 126, Number: 31250
< 2017-07-14 11:15:16.782 Type: SSH_FXP_STATUS, Size: 19, Number: 31250
< 2017-07-14 11:15:16.782 Status code: 0
. 2017-07-14 11:15:16.782 Preserving timestamp [2017-07-14T09:12:43.000Z]
> 2017-07-14 11:15:16.782 Type: SSH_FXP_SETSTAT, Size: 73, Number: 1033
< 2017-07-14 11:15:16.798 Type: SSH_FXP_STATUS, Size: 19, Number: 1033
< 2017-07-14 11:15:16.798 Status code: 0
. 2017-07-14 11:15:16.798 Transfer done: 'X:\Projecten\FTP00000050558\6478370_PDOL_batchimport20170714_111239.zip' [4131266]
WinSCP Transfer completed x:\projecten\ftp00000050558\6478370_pdol_batchimport20170714_111239.zip . 2017-07-14 11:15:16.798 transfer done: 'x:\projecten\ftp00000050558\6478370_pdol_batchimport20170714_111239.zip' [4131266]
> 2017-07-14 11:15:16.798 Script: exit
. 2017-07-14 11:15:16.798 Script: Exit code: 0
. 2017-07-14 11:15:16.798 Closing connection.
. 2017-07-14 11:15:16.798 Sending special code: 12
. 2017-07-14 11:15:16.798 Sent EOF message
X:\Projecten\FTP00000050558\FTP00000050558.winscp deleted OK
martin

Re: ExitCode1

Please attach a full session log file of both runs (using the latest version of WinSCP).
Camialra

ExitCode1

Hello,
I am calling winscp.com with a script executing with a shell command.
The first time that I run the application I do receive a ExitCode1 error and the second one the problem is gone.
The shell command has its own 'execute external exit code' and before I trigger the executable I made the variable emplty. It doenst work at all.

aE:='P:\Applic\Resources\WinSCP\WinSCP.com';
WinSCPLog:=TranslateParams(WinSCPLog);
sc:=TranslateParams(sc);
aP:='/log="'+WinSCPLog+'" /loglevel='+inttostr(SetupDLG.ScriptLoglevel)+' /ini='+SetupDLG.ScriptIni+' /script="'+sc+'"'

ExecExtrnExitCode:=0;

try
ExecuteExternal(aE, aP, '', False, 'Executing WinSCP', SetupDlg.WinSCPVisable, ExecExtrnExitCode);
if ExecExtrnExitCode<>0
then AddError('WinSCP Exitcode: '+IntToStr(ExecExtrnExitCode));
except
AddError('WinSCP.com error');
end;