Try to find 'ebook-convert' (from Calibre) and use it if KindleGen is no...

 Try to find 'ebook-convert' (from Calibre) and use it if KindleGen is not in current directory.

It gives preference to KindleGen over ebook-convert.

I haven't tested in Windows, but I think 'spawn' should be able to find ebook-convert in %PROGRAM_FILES%, etc.