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

Re: Delaying scripted task until it completes

Yes, that's expected behavior.
But you are not going to type your command batch on command-line, right?
I assume you will rather run your command batch from some script like batch file or PowerShell or whatever. All those will (or can) wait for WinSCP to finish.

Anyway, if you really want to type commands on command prompt (and even if you are going to use batch file or PowerShell), you should not use winscp.exe, you should use winscp.com.
cmd.exe will not only wait for winscp.com to finish. You will also see what WinSCP is doing, what you don't with your current command.

See https://winscp.net/eng/docs/executables
bconner

Re: Delaying scripted task until it completes

martin wrote:

bconner wrote:

When I run the command line, control immediately returns to the next line while winscp processes the request in the background.

That still does not tell us anything about how you "run the command line" and what "next line" are you referring to.

Hi Martin,
Sorry, here's the command I run at the command prompt:
c:\>"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="g:\WinSCP.log" /ini=nul /script="g:\winscp_script_nh.txt" /parameter 01082019

When I run it, it returns immediately to the c:\> prompt and I see Winscp running as a task in the background. Is that expected behavior?

--Ben
martin

Re: Delaying scripted task until it completes

bconner wrote:

When I run the command line, control immediately returns to the next line while winscp processes the request in the background.

That still does not tell us anything about how you "run the command line" and what "next line" are you referring to.
bconner

Re: Delaying scripted task until it completes

martin wrote:

WinSCP does not exit until its commands are finished (obviously).
So the problem must be with the way you run (and wait for) WinSCP. So we need to know how you run WinSCP.

Hm. I'm not sure then. I open a command window and then run the following:

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="g:\WinSCP.log" /ini=nul /script="g:\winscp_script_nh.txt" /parameter 01082019

The script has an open statement, a synchronize and an exit. When I run the command line, control immediately returns to the next line while winscp processes the request in the background.

--Ben
martin

Re: Delaying scripted task until it completes

WinSCP does not exit until its commands are finished (obviously).
So the problem must be with the way you run (and wait for) WinSCP. So we need to know how you run WinSCP.
bconner

Delaying scripted task until it completes

Good morning,
I've been able to get the scripting to work well for my project but noticed the command returns immediately while it is processed in the background. I need it to wait until it completes before continuing. Is there an option to trigger that?

Thanks!

--Ben