How to install Drush 8 (for Drupal 7 and 8) on Windows 7, 8 and 10

Tue, 2016-07-12 01:56

OK. This is not exactly a step-by-step guide to install. It is not, because you do not need a "guide" or an "installer" to install Drush 8 (or 7 for that matter) anymore.
There used to be Drush install packages, and you had to make some changes here and there to get Drush working. This assumes you already have a working PHP and MySQL setup. If you do not, I can recommend Laragon because it comes with multiple PHP versions, MariaDB, several PHP extensions including opcache, etc. Note that Laragon comes with several other tools too, including Composer, a mail catcher, git, etc.

Composer

You need Composer already installed. If you do not already have it, head over to GetComposer, download the Windows installer, and install it. You could also manually install it but the self-install works fine.

PATH

This step only applies if you have not already installed Composer, and the composer installation folder's vendor/bin folder is not already in your operating systems PATH variable. There are plenty of posts about that, this one comes very detailed.

Install Drush

This is the actual part you are probably looking for. Open your favorite shell (cmd, Git's bash, etc), and type this:

composer global require drush/drush:8.*

composer global require drush/drush:8.*

This will install Drush version 8, which is compatible with all three latest Drupal versions.

If you have a cygwin environment from git bash, you can type which drush to find out the installation path. You do not have to add this new folder to your system PATH, because you have already added the parent folder.

which drush

See it working:

drush status

Comments

Hello, I was wondering if you have run into this problem before? I have installed composer and drush,drush but neither command prompt nor git bash recognize drush.

Drush commands just return C:\Users\usr\drush in not recognized as an internal or external command, operable prgram or batch file, even though the PATH variable seems to point to the correct location.

I'm running windows 10, Composer version 1.2.0, and I installed drush 8.1.3.

Your thoughts