How to work around ebook-convert.exe (in calibre portable) halting batch file execution?

437 Views Asked by At

I use ebook-convert.exe from a batch file, and on one of my machines (old Windows vista laptop), any calls ebook-convert.exe prevent further commands in a batch file from running (in that .bat file, or in that cmd shell instance for instance). The conversion to .mobi actually succeeds, prints no errors even in -v -v full verbose mode. I tried versions 1.20.0 and 0.9.6 of calibre portable. It seems to be related to the executable itself, and not to the specific conversion job (just running it with -h flag has same effect). I tried running cmd in administrator mode, wrapping it with 'call' command, nothing helps. Assuming the calibre issue is a black hole that can't be solved, is there a DOS trick I could possibly try to keep batch commands running no matter what odd thing happens with ebook-convert.exe on that machine?

1

There are 1 best solutions below

1
Anders On

Using call in a batch file should work on normal console programs but it is possible for programs to "escape" if they really want to.

Using Start instead might work but it does not wait by default and its syntax is not sane:

 Start /B /WAIT c:\path\without\spaces.exe optionalParameter

or

 Start "" /B /WAIT "c:\path\w i t h\spaces.exe" optionalParameter

Remove /B to run the application in a new console.

Another option is to call ping localhost and For (to get the file size with %%~zA) in a loop until the size of the destination file stops increasing. This is a bit of a hack and might not work, it depends on how the converter opens the file and how often it flushes the writes.