Calling via Command Line returns immediatley

Get help for specific problems
Posts: 1
Joined: 29 Jul 2017

acarra

Running V9.2 on a Windows Server 2012 x64 install.

When I try and execute a ffs_batch file using the command line, I am finding that FreeFileSYnc returns immediately, and not at the completion of the task.

If I execute the following in a command prompt window:

"C:\Program Files\FreeFileSync\FreeFileSync.exe" C:\scripts\SyncWAFS.ffs_batch

The program returns immediately with ErrorLevel 0.
In Task Manager, I can see then that in fact the process has started and that it has spawned the x64 version.
The running processes run to completion and actually execute the batch job.

However, this execution is done Asynchronously.
The documentation shows that the process should by synchronis, and that it blocks until the task completes, returning the execution status in the ErrorLevel variable.

What am I doing wrong?
User avatar
Posts: 31
Joined: 26 Nov 2017

shai

I'm having this save issue. Zenju can you help?
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

Can you be more precise regarding "same issue" and provide some more details? Or maybe even steps to reproduce?
Posts: 292
Joined: 13 Apr 2017

Gianni1962

Try:

start /wait "C:\Program Files\FreeFileSync\FreeFileSync.exe" C:\scripts\SyncWAFS.ffs_batch
User avatar
Posts: 31
Joined: 26 Nov 2017

shai

Can you be more precise regarding "same issue" and provide some more details? Or maybe even steps to reproduce? Zenju, 27 Nov 2017, 17:01
I'm not sure how more specific you want me to be. I'm saying that I have the same exact issue that the OP has.

I open a command prompt.
I type this command exactly as pasted here: C:\Users\shai>"C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\bin\freefilesync\Drives C and X to W.ffs_batch"

It immediately exists and returns to the command prompt. It won't "wait" until the sync is complete.
The errorlevel from it is always 0. Since it doesn't wait for the sync to finish and evaluate the exit code of the sync.
User avatar
Posts: 31
Joined: 26 Nov 2017

shai

also, perhaps this is expected behavior by CMD? And what Gianni1962 above said is how to correctly start a job in command line without it returning to command prompt instantly after execution?

The documentation does say "You can evaluate these codes from a script (e.g. a cmd or bat file on Windows) and check if synchronization completed successfully" and indeed, in a batch script this works as expected.
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

also, perhaps this is expected behavior by CMD? And what Gianni1962 above said is how to correctly start a job in command line without it returning to command prompt instantly after execution? shai, 27 Nov 2017, 18:42
Indeed, this seems to be the case.
User avatar
Posts: 31
Joined: 26 Nov 2017

shai

Case closed IMHO :)
User avatar
Posts: 31
Joined: 26 Nov 2017

shai

Also, it might be worth while, since it has come up, to add this to the documentation for future reference. I'm sure someone else would RTFM and come here afterwards.