Solution to "The filename, directory name, or volume label syntax is incorrect." error in Drush custom PHP path

It is possible to assign a specific PHP version to execute Drush commands for special Drupal site via Drush aliases configuration file. However in Windows, we can get error:

The filename, directory name, or volume label syntax is incorrect.

… if the we follow the Windows syntax path.

This error is printed from C:\composer\vendor\drush\drush\includes\

 * Execute bash command using proc_open().
 * @returns
 *   Exit code from launched application
 *     0 no error
 *     1 general error
 *     127 command not found
function drush_shell_proc_open($cmd) {
  if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
    drush_print("Calling proc_open($cmd);", 0, STDERR);
  if (!drush_get_context('DRUSH_SIMULATE')) {
    $process = proc_open($cmd, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes);
    $proc_status = proc_get_status($process);
    $exit_code = proc_close($process);
    return ($proc_status["running"] ? $exit_code : $proc_status["exitcode"] );
  return 0;

The solution is change the:

'php' => 'C:\WinNMP\bin/PHP\64bit-php-7.0\php.exe',

… to:

'php' => 'C:/WinNMP/bin/PHP/64bit-php-7.0/php.exe'


'php' => '/WinNMP/bin/PHP/64bit-php-7.0/php.exe',


Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.