Post a reply

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

martin

Ctrl+C should be safer way to cancel the script.
mas985

I experimented with this and confirmed that a fragment was left behind and was dated with the current time. I re-ran the script and it seems to download the file again with the correct modified date which is a good thing so at least it corrects the file after the fact.

There are times where I run a long script and for one reason or another, need to cancel it and run it at a different time so I was just curious as to what might happen.

Thanks for your help!
martin

Ok, I see. No, WinSCP does not terminate gracefully. You are the first one to ask for it.
I've added this request to the tracker:
Issue 2348 – Graceful termination when console window is closed
Though even if it did, I do not think that it would leave no file corrupted. It would likely do the same what it does when a transfer is interrupted for whatever other reason.
mas985

I don't think you understood my question.

I know that the underlying process stops when the windows command window closes. However, what I want to know is exactly how WinSCP closes. When a command window is forced closed, Windows sends the application a close command but how does WinSCP respond to that command while in the middle of transferring a file? Does WinSCP close gracefully so that no files in the process of being downloaded are corrupted?
martin

Re: Forcing batch command window closed

Afaik, closing the console window terminates any process running in that window.

If you do not want the console window to show, use WinSCP.exe.
See https://winscp.net/eng/docs/executables
mas985

Forcing batch command window closed

I am running WinSCP in a windows batch file and I was wondering if it is safe to force the command window closed before WinSCP completes the tasks. Will WinSCP end gracefully and not fragment a partially downloaded file?