exit command at the end of winscp.com command closes all windows and the batch script cannot continu

Advertisement

ger_serrano@...
Guest

exit command at the end of winscp.com command closes all windows and the batch script cannot continu

I have this command in a batch script:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="X:\cme\ftp_files\DailyLog\WinSCP.log" /ini=nul ^
/command ^
"open sftp://acoscftp:""@NLJl!xS<mqq""@sftpng.cmegroup.com/ -hostkey=""ssh-rsa 2048 jnrVgUsNrZ+VmunhM0XrnWnlc2gVhSBOK+jFx5vQoMc=""" ^
"cd Outgoing" ^
"get -filemask=""CME*.zip>=5D"" -transfer=binary /cme/ftp/OSC/Outgoing x:\CME\ftp_files\Download" ^
"exit"

But the "exit" terminates completely the script. As a workaround I created two scripts one with the winscp commnad and then another one that exec utes after the winscp finishes.
Is there another way of terminating the winscp.com commands sucha as "exit /b" ?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: exit command at the end of winscp.com command closes all windows and the batch script cannot continu

Your batch file works for me correctly (you should not really post your credentials).

If it does not work for you, my guess is that you have a space after ...Download" ^, what got lost when posting the code on the forum.

If this does not help, please post the batch file zipped as an attachment, so that it stays intact.

Reply with quote

Guest

The file works because this the one I have created as a workaround. The problem happens when I put that code within another script that deals with the files after being downloaded. For example in the script I have logic to unzip the files but that logic is not executed because the exit, as I mentioned, terminate the script and only the winscp.com commands are executed. By the way can you please scramble the credentials?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Your batch file works for me. I do not know how to help you.

Note that you have a tab instead of space before exit command. But even that way, it works for me.

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

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Guest

Thanks Martin. I removed the TAB before the exit command and now it is working both from the command line and from Windows task scheduler.

Reply with quote

Advertisement

You can post new topics in this forum