"drush sapi-i" command which calls drush_backend_batch_process() fails with "Output is empty" I am trying to integrate ElasticSearch with Drupal and till now everything seems to be working except that the command drush sapi-i crashes with the output:

&gt; 'C:/xampp/htdocs/my-project/docroot/vendor/bin/drush' is not recognized as an internal or external command,
&gt; operable program or batch file.

In ProcessBase.php line 172:

  Output is empty.


search-api:index [--limit [LIMIT]] [--batch-size [BATCH-SIZE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] &lt;command&gt; [&lt;indexId&gt;]


After debugging with drush sapi-i -d it seems the call to drush_backend_batch_process() causes the issue for some reason.
After checking the vendor/bin directory I noticed that the drush script exists but drush.bat or drush.cmd were missing, I mean, for some reason even though I executed the drush sapi-i command using Git-bash, Drupal was still trying to access the Windows type of the file (which didn't exist in the source I copied from Mac).
so creating the below file manually fixed the issue.

drush.cmd file:

@echo off
setlocal DISABLEDELAYEDEXPANSION
php "%~dp0../drush/drush/drush" %*


drush file:

#!/usr/bin/env sh

dir=$(cd "${0%[/\\]*}" &gt; /dev/null; cd '../drush/drush' &amp;&amp; pwd)

if [ -d /proc/cygdrive ]; then
    case $(which php) in
        $(readlink -n /proc/cygdrive)/*)
            # We are in Cygwin using Windows php, so the path must be translated
            dir=$(cygpath -m "$dir");
            ;;
    esac
fi

"${dir}/drush" "$@"


Note that the drush script's line ending should be LF (instead of CRLF which drush.cmd needs),
so in Git-bash simply cd to where your script is and run sed -i 's/\r$//' my-script-filename (if your editor can only save with CRLF).