Post a reply

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)


Topic review


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.

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.

My bad. Any commands after line 9 of the script I attached are NOT executed.

Any commands after line 9 are executed.

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 commands are executed. By the way can you please scramble the credentials?

Re: exit command at the end of 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.

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

I have this command in a batch script:
"C:\Program Files (x86)\WinSCP\" ^
/log="X:\cme\ftp_files\DailyLog\WinSCP.log" /ini=nul ^
/command ^
"open sftp://acoscftp:""@NLJl!xS<mqq"" -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" ^

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 commands sucha as "exit /b" ?