code: function resolveWindowsExe(cmd) {
      var winExtensions = ['.exe', '.cmd', '.bat', '.js', '.vbs'];
      function isValidExe(c) {
          return winExtensions.indexOf(path.extname(c).toLowerCase()) !== -1 && fs.existsSync(c);
      }
      if (isValidExe(cmd)) {
          return cmd;
      }
      try {
          cmd = which.sync(cmd);
      } catch (e) {
          // just ignore which's whining
      }
      if (!isValidExe(cmd)) {
          winExtensions.some(function(ext) {
              if (fs.existsSync(cmd + ext)) {
                  cmd = cmd + ext;
                  return true;
              }
          });
      }
      return cmd;
  }
docs: On Windows, spawn() for batch files requires absolute path & having the extension.