I manage a lot of Drupal sites and drush is a lifesaver. I usually script what I need done and then loop over all of the sites.

Many times I need to execute several Drush commands on the same site. Because Drush has to go through the bootstrap process for each command it can be a bit slow. So if I do three commands, Drupal gets bootstrapped three times. Example:

  • drush cc all
  • drush dl freds_module
  • drush en --yes freds_module

So is there any way to run multiple commands with one bootstrap? Something like:
drush "cc all" "dl freds_module" "en --yes freds_module"

The idea is to bootstrap drush only once rather than three times. If it is not possible, I'll still be happy with Drush.


  • In this exact example drush en --yes freds_module is enough: it will download the module if not present and also clear caches after enabling.
    – jonhattan
    Commented Sep 23, 2014 at 21:13

6 Answers 6


From my personal experience, I would run these tree commands like this: drush cc all; drush dl freds_module; drush en freds_module --yes. I use semicolons to separate my commands. You can also use the ampersand(&&), drush cc all && drush dl freds_module && drush en freds_module --yes. Here, if one command fails, the rest will not run.


A simple way is create bash file in Linux or batch file in windows,put your command in batch(bash) file and run it.

simple example if create bash file in linux

simple example if create batch file in windows

  • Just wanted to add to this answer> I completed an upgrade from a d6 to d7 which required a couple hundred drush commands. Considering I tested the thing like 20-40 times, a bash file is really the way to go.
    – Jance
    Commented Sep 22, 2014 at 16:47

You can also make Drush shell aliases to run drush and bash commands. It is possible to place multiple commands in these Drush shell aliases using the method that Hectorplus mentions in his answer by separating them with &&.

Adding the following to your drushrc.php in one of the 6 possible locations.

$options['shell-aliases']['en_freds_module'] = 'drush cc all && drush dl freds_module && drush en --yes freds_module';

Then you can run the Drush shell alias with:

drush en_freds_module

I'm not sure if you can execute multiple commands like that, but with your specific example, drush en freds_module --y will download the module if it is not already present. (The -y flag will answer yes to all prompts.)

Note that this was added in Drush 6.0.0 (#1364814 by eiriksm, jonhattan: Added Extend pm-enable to offer downloading the project for missing extensions.)


One option is to use Drush alias command in your "drushrc.php" file. There is lots of examples and documentation at https://github.com/drush-ops/drush/blob/6.x/examples/example.aliases.drushrc.php

On the left side of that page. Under "branch" menu. Select the appropriate Drush version.


In your example cc, dl and en can be replaced just by one command:

drush -y en some_module

It'll automatically download and enable the module at the same time. If module defines new menu items and other hooks, most of the time cache is cleared as well.

If you'd like to use drush for other multiple commands, there is no straight forward solution other than passing them as list or creating your own custom drush command.

You can also create alias command in your drushrc.php, in example:

  'debug-enable' => '!
    drush vset --yes rules_debug 2 \
    && drush vset --yes rules_debug_log 1 \
    && drush -y en devel
    && drush views-dev

so executing one drush debug-enable command, it actually will execute multiple commands. If you prefer run them multiple simultaneously, consider running them in the background (&).

Alternatively as workaround use drush_hook_post_COMMAND() and drush_hook_pre_COMMAND() to perform additional tasks within one bootstrap for specific command (e.g. clearing caches after pm-enable).

If this is part of the script, another trick is to send different drush processes into the background at the same time and wait for them (works with Bash), e.g.

drush -y en dblog devel &
drush -y updb &
drush -y fr mymodule &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.