The exit code is not returning in the bat command of WinSCP version 6.1.1

Advertisement

dilipdhamodharan
Joined:
Posts:
3
Location:
US

The exit code is not returning in the bat command of WinSCP version 6.1.1

Hello,
Below is my script for connecting and sending files. Currently i m using 5.15.3 and whenever I run I get Exit code and Max round trip. In the newer version which I am trying to upgrade i.e., to 6.1.1 the command executes successfully but does not return the exit code nor the maximum round trip. Is there anything I am missing to enable somewhere? This is critical for my processing to work as it is working in 5.15.3

Code:
echo open "sftp:eft_dilip:<Password>@<Site_Name>">\\shared_path\testing\&$RUNID#.ftp
echo option confirm off >>\\shared_path\testing\\&$RUNID#.ftp
echo option transfer binary >>\\shared_path\testing\\&$RUNID#.ftp
echo ls >>\\shared_path\testing\\&$RUNID#.ftp
ECHO put -delete "\\shared_path\testing\\*.pgp" >>\\shared_path\testing\&$RUNID#.ftp
ECHO exit>>\\shared_path\testing\&$RUNID#.ftp
winscp.com /script=\\shared_path\testing\&$RUNID#.ftp
Output:
Searching for host...
Connecting to host...
Authenticating...
Using username "eft_dilip".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] eft_dilip@eft.se2.com
confirm         off       
transfer        binary    
drwxrw-rw-   1 user     group            0 May 24 12:59:20 2023 backup
-rw-rw-rw-   1 user     group         2278 Apr 21 14:29:35 2023 log.txt
drwxrw-rw-   1 user     group            0 May 24 12:59:20 2023 moveitem
drwxrw-rw-   1 user     group            0 May 12 11:50:19 2023 recording_file
D---------   0                           0              ..
No file matching '*.pgp' found.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: The exit code is not returning in the bat command of WinSCP version 6.1.1

What do you mean by "returning"? WinSCP is always returning an exit code. Though from your reference to "maximum round trip", which is logged to session log or printed to console along with the exit code, I assume you mean that you want WinSCP to print the exit code (in addition to retuning it). Afair, nothing has has changed regarding that in WinSCP 6. The exit code is printed to console only when debug logging is enabled. As you didn't specify the debug logging on your WinSCP commandline, if it ever worked in WinSCP 5, it's because you must have debug logging enabled in WinSCP GUI. And as you don't isolate WinSCP script run from WinSCP GUI configuration (what is against recommendations), the script picks up the GUI logging configuration.
I assume you run WinSCP 6 on a different machine or in a different environment than WinSCP 5, with different GUI logging configuration.
You can enable debug logging explicitly on WinSCP commandline with:
winscp.com /loglevel=1 /script=...
https://winscp.net/eng/docs/commandline#logging

Reply with quote

dilipdhamodharan
Joined:
Posts:
3
Location:
US

Thanks Martin. I did try enabling the debug mode in GUI and adding Log level in script still the same issue. Below is the one I get while running in 5.15.3.
Searching for host...
Connecting to host...
Authenticating...
Using username "eft_dilip".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] eft_dilip@<ftp_sitename>
confirm         off       
transfer        binary    
Drwx------   0                        1024 Sep  7  3:32:04 2023 ..
Exit code: 0
Max roundtrip: 0
where as the last two lines are not getting displayed in newer version for me. As for the environment the 6.1.1, I am testing in my QA region and 5.15.3 is in my Prod region.

Reply with quote

Advertisement

You can post new topics in this forum