Last updated September 23, 2015. Created on October 3, 2009.

## Install Drush on Windows - The easy way.

Installing latest Drush on Windows is no more fun. Since composer is required everything has changed to the bad. The documentation on drush.org and composer is incomplete and lacks highly important requirements.

Here are the complete steps you need to take:

1. Install Cygwin
1. Install ncurses package. You need to select ncurses manually in cygwin setup. If you miss to install this you will get an error message that tput is missing.
2. Install Git package
3. Install bsdtar package or you cannot restore archives and get errors like Unable to untar and Unable to extract site archive tarball.
4. Install Curl package or you cannot disable modules.
2. Now install Composer for Windows globally.
3. Install Drush the common way. e.g. Drush 7.x (stable):
composer global require drush/drush:7.*


NOTE: Drush cannot run with GnuWin32 as it has no sh.exe support.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

### Clarification

Although this is elaborated on the issue resolution - it should be clarified here also. The PATH environment variable should be assigned by going to My Computer > Right-click any blank area inside window > Properties > Advanced tab > Environment Variables > System Variables > select PATH & edit as described.

This instruction is for Windows XP SP3 32-bit.

Thank you,
Ivan

### User path on Windows 8.1 not recognized in git bash window

On Windows 8.1, for reasons I don't understand, drush 6.0 installed fine via the windows installer and ran from the DOS command window, but would not run from the git bash window. Only the system path was recognized. I added the PHP path to the system path, and it work. I removed it (leaving it in the user path), and it still worked. Perhaps some odd caching??

### %* works, no need for step 4

On windows XP, %* works and accept all arguments, so I'm not sure you need to put %1 %2..., although setting up this would limit you to 9 arguments...

### Works on Windows 7 Home Premium 64-bit.

Works on Windows 7 Home Premium 64-bit.

### dl not working in XP SP3

I tried this
drush dl cck
It didnt work even after installin .dll file

### Windows 7 64 bits with IIS 7.5

A little variation that works for me.

;C:\Program Files (x86)\PHP;C:\inetpub\wwwroot\drush;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin

2. For drush.bat, keep the original. No need to change anything. Although as recommend to put the full path to php.

Drush ruless !

### Due to respect to all

Due to respect to all experienced ppl, how do I copy an .exe to another .exe? I dont understand the following instruction:

Copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe

???

### Check out the installation

Check out the installation video mentioned above, at http://vimeo.com/15371661 , as it shows the process.

### SSH needed?

It looks like I also need SSH. Can't find it within gnuwin. Any clues?

### Generally speaking, you don't

Generally speaking, you don't need ssh to install drush on windows on a personal development environment such as your laptop. If you are trying to connect to a remote server, then you may need ssh, in which case you can either use PuTTY or Cygwin. You can see more information here.

If you are trying to follow these instructions on a server, you might run into a few problems because you probably won't have the permissions to install the gnuwin32 programs or alter the path variables. You'll have to talk to your hosting provider.

### $drush or$drush.bat both

$drush or$drush.bat both work on Windows
I was under the impression that I had to call drush.bat on Windows but drush works fine as an alias

### has anyone had success with drush make on WAMP?

I've not been successful. there are some known issues but was hoping someone had a workaround. I'm at the point of building a virtual linux stack on my windows machine...

### Drush is independent of WAMP

I have successfully installed drush on Win7, independently of my WAMP (http://www.wampserver.com/en/) installation (drush in its own directory outside WAMP and with a different version of php).
The layout is like this:
c:\wamp
e:\drush
e:\gnuwin32
e:\php <-- used with drush (zipped, not installed)

### You may get warnings when using xampp

When using xampp on windows you may get warnings like "PHP Startup: Unable to load dynamic library (...)".

In this case look at the php.ini file (since xampp 1.7.1 in the xampp\php folder see: http://www.apachefriends.org/en/faq-xampp-windows.html#phpini).

I had to change the line 'extension_dir = "\xampp\php\ext"' to 'extension_dir = "E:\xampp\php\ext"' and do the same for browscap.

### when I open the bat file I

when I open the bat file I just get @echo off
@php.exe "%~dp0drush.php" %*

what am i supposed to do to the bat file?

### Step 2?

Can someone clarify Step 2? Copy to the directory? Why is it telling us to copy to the ...exe file?

### it means: Copy AND RENAME the

it means: Copy AND RENAME the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe

In shell scripting the copy command can also rename a file, so copying to a new filename implies renaming it.

You should learn how to use the Windows command terminal (cmd.exe) which basically uses DOS syntax. You will need to use it for Drush on Windows. There are also replacements for the default teminal, such as Console.

### My path to php

My path to php c:\wamp\bin\php
path to Drush c:\wamp\www\drush

I ran "drush' on cmd and get the following :
'php.exe' is not recognized as an internal or external command, operable program or batch file.
What may I have done wrong ?

### Never mind. I had path to

Never mind. I had path to php.exe wrongly declared in drush.bat . It works now !

### Trouble with Drush in Windows 7

Hi, I've got problem with dosn't working Drush on Windows 7. I have instaled Apache+PHP+Mysql server.
When I want to start Drush I've got information about absence php_mbstring.dll library despite of it's in c:\Program Files\PHP\ext\ catalog. Although it dosn't found OCI.dll; aspell-15.dll; libcs.dll libraries.
I've got instaled Gzip; Libarchive; Wget; Tar programes. In "Control Panel > System > Advanced System Settings > Environment Variables->Path".
I have path "C:\Program Files\PHP;C:\drush;C:\Program Files\GnuWin32\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin".
In file drush.bat I've code;
"@c:\Program Files\PHP\php.exe "%~dp0drush.php" %*
@c:\Program Files\PHP\php.exe C:\drush\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9"

### Try using an integrated WAMP

Try using an integrated WAMP distro - it looks like you installed Apache and PHP and MySQL separately and may have configuration problems.

I use Xampp for Windows

There is also a Dev Desktop by Acquia that includes the *AMP stack and Drupal

I am using Xampp and I can confirm that Drush is working on Windows 7. My command line looks like this with PHP included in xampp. Notice that I am not using the C:/Program Files/ directory at all, it's in the root:

Microsoft Windows [Version 6.1.7600]

c:\xampp\htdocs\drupal71>drush status

c:\xampp\htdocs\drupal71>c:\xampp\php\php.exe "C:\drush\drush.php" status

Drupal version                :  7.0
Site URI                      :  http://default
Database driver               :  mysql
Database hostname             :  127.0.0.1
Database name                 :  d70
Database                      :  Connected
Drupal bootstrap              :  Successful
Drupal user                   :  Anonymous
Default theme                 :  bartik
PHP configuration             :  C:\xampp\php\php.ini
Drush version                 :  4.0-dev
Drush configuration           :
Drupal root                   :  C:/xampp/htdocs/drupal71
Site path                     :  sites/default
File directory path           :  sites/default/files
Private file directory path   :  /backup_migrate

c:\xampp\htdocs\drupal71>


### Step 3

Using Xampp installed at c:\xampp the PATH to PHP is c:\xampp\php

### Step 4

In drush.bat I had to change

@php.exe "%~dp0drush.php" %*

to

@php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9

### thanks

thanks for the help
what is Photoshop

### Create tmp folder

I had to create C:\tmp to avoid "Fail to open stream" errors.

### Success

Got it working with above instructions and a minor tweak for the batch file:
http://drupal.org/node/506448#comment-4585172

succesfull on Win 7 Professional, 64bit, Acquia stack (6.20)

Albert Skibinski - ezCompany

### Git

If using Git and Drush isn't finding it, add the path to Git/bin to your Path environment variable; e.g. ;c:\Program Files (x86)\Git\bin. Then restart whatever shell you're using (i.e. cygwin).

### Works on Windows 7

Works on Windows 7 Professional 32-bit.

Thanks!

---
my blog

### Patching Drush

Where are the instructions for applying a patch to drush for windows?

### I use the Eclipse IDE for

I use the Eclipse IDE for patches, applying and creating them.

I've tried other Windows patch tools, but Eclipse just does it. In fact, that is about all I use Eclipse for these days.

Eclipse Helios had a distro for PHP developers

The current release Indigo doesn't; maybe they just rolled it into the Classic distro?

I also used the Subclipse plugin to integrate my Eclipse projects with Subversion.

It's also pretty easy to create and apply patches with Git and it's the method to use for Drupal projects

### Work on Windows 7 64 Bit

This procedure also work on Windows 7 Professionals 64 bit.

My PATH C:\drush\;C:\Program Files (x86)\GnuWin32\bin;C:\xampp\php

Thanks

### i get this error and i am not sure what i am doing wrong

C:\ProgramData\Propeople\Drush/lib/drush-library-1301704602.tar.gz
using the gzip command failed.

### @RyanC you need to have

@RyanC you need to have GnuWin and the Gzip package installed

### C:\Users\lwebg>drush Uncompre

C:\Users\lwebg>drush
Uncompressing C:\drush/lib/drush-library-230983746.tar.gz using the [error]

gzip command failed.

I get this error and the gzip package is installed.

### You can use another Windows

You can use another Windows unzip app like 7zip to decompress the archive

but you might want to see what else is wrong with your setup ;)

### sohbet

Thanks you sohbet

### Windows 8

I know I am in the minority, but does anyone have any information on Windows 8 and Drush?

Cheers.

### How to install Drush on Windows 8

Please share the information if anyone have idea about how to install Drush on Windows 8 machine.

Thanks

### Windows 8.1 pro

Do anybody have some info about installing Drush on Win 8.1 pro?

Although it is mentioned in top line that this tutorial was updated 16th April, the very first line in installating the hard way, Drush download url has not been corrected.
Kindly update that to GITHUB from drupal.org https://github.com/drush-ops/drush

### Drush Windows Installer offline?

The drush windows installer site is offline and does also not seem to be hosted on the git hub drush ops site.

>>>>>> found it >>>>>>>

https://github.com/drush-ops/drush/commit/0988485788c160f1c4c3c485625585...

:)

### The drush command 'status' could not be found

Hi,

I have follow all steps but again show this error blow :-

The drush command 'status' could not be found, Run 'drush cache-clear drush' to clear the commandfile cache if you have installed new extensions. function and the attempt to download this file automatically failed.To continue you will need to download the 1.1.3 package from website

### Drush on windows 8.1

For my windows 8 I used the exe file to install Drush. Then I set the path like cited above in
control panel>system and security>system>advanced system settings> environment variables
And it was done. Had a few issue with a step by step installation, but the exe did the trick!
Now it's working fine Apart from a migrate thing havent quite figured out yet, but I guess that's just me ;)

If still you're getting this error on Windows 7, then you should add this in your "Environment Variables"
C:\ProgramData\Drush;D:\xampp\php

Since, my XAMPP is installed in D drive, hence I've used that accordingly.

### Windows 7 64, cygwin, composer, 'drush up drupal error.

I have followed all the steps above. Everything seems to work correctly as far as I can tell. Here's the output of 'drupal status' command.

 Drupal version                  :  7.32
Site URI                        :  http://default
Database driver                 :  mysql
Database hostname               :  localhost
Database port                   :
Database name                   :  db
Drupal bootstrap                :  Successful
Drupal user                     :
Default theme                   :  theme548
PHP executable                  :  /cygdrive/c/wamp/bin/php/php5.5.12/php
PHP configuration               :  C:\wamp\bin\php\php5.5.12\php.ini
PHP OS                          :  WINNT
Drush script                    :  C:\Users\dev\AppData\Roaming\Composer\vendor\drush\drush\d
rush.php
Drush version                   :  7.1.0
Drush temp directory            :  C:\cygwin64\tmp
Drush configuration             :
Drush alias files               :
Install profile                 :  standard
Drupal root                     :  C:\wamp\www\projects\dev\Mirror
Site path                       :  sites/default
File directory path             :  sites/default/files
Private file directory path     :  sites/default/files/private
Temporary file directory path   :  /tmp

However, when I execute the following command, I receive an error.

drush -v up drupal

Initialized Drupal 7.32 root directory at                   [notice]
C:\wamp\www\projects\dev\Mirror
Initialized Drupal site default at sites/default            [notice]
Executing: mysql --defaults-extra-file="C:\\cygwin64\\tmp\\dru2DAB.tmp" --database=db --host=localhost --silent  < "C:\\cygwin64\\tmp\\dru2DAA.tmp"
Executing: mysql --defaults-extra-file="C:\\cygwin64\\tmp\\dru2E29.tmp" --database=db --host=localhost --silent  < "C:\\cygwin64\\tmp\\dru2E28.tmp"
Executing: wget --version
/cygdrive/c/wamp/bin/php/php5.5.12/php                      [notice]
"C:\\Users\\dev\\AppData\\Roaming\\Composer\\vendor\\drush\\drush\\drush.php"
--php=/cygdrive/c/wamp/bin/php/php5.5.12/php  --backend=2
--verbose
--root="C:\\wamp\\www\\projects\\dev\\Mirror"
Illegal string offset 'site' backend.inc:1030            [warning]
The command could not be executed successfully (returned:[error]
The system cannot find the path specified.
, code: 1)
Command dispatch complete                                   [notice]
Command dispatch complete                                   [notice]


The specific error being returned:

Illegal string offset 'site' backend.inc:1030            [warning]
The command could not be executed successfully (returned:[error]
The system cannot find the path specified.
, code: 1)

I cannot seem to track down this issue and I do not know enough about Drush to fix this error.

Can anyone offer any assistance?

### I'm having the same issue as

I'm having the same issue as well.

### WAMP - Drush 8 - D8 - also fails

\$ drush up
Illegal string offset 'site' backend.inc:1035 [warning]
The command could not be executed successfully (returned: Syntax wrong.... (in danish)., code: 1) [error]

### if you do a drush status in

if you do a drush status in your site folder and the PHP executable starts with /cygdrive/..., you will get this error.
I just set up 2 W2012 Core servers and one is having this issue, the other doesn't. I re-installed drush on my local machine and I'm having this issue as well.
Provided the PATH environment variable has the path to your php.exe, the PHP executable path (from the Drush Status output) should be php.exe.

The temporary workaround if you have this issue is to add --php=php.exe to your command.

I'm hoping I can update with the solution soon.

Edit: It seems like %COMPOSER_HOME%\vendor\bin\drush.php is the culprit in this case.
I managed to fix it locally by replacing %COMPOSER_HOME\vendor\bin in my PATH system variable with %COMPOSER_HOME%\vendor\drush\drush

### Having same issue in Windows

Drush gives no output in Windows 10... Tried both a Drush Cygwin install with the phar and PowerShell install with Composer

Drush unpacked to /usr/local/src/drush/drush.bat and files looks fine. Running PHP shell scripts works fine. Error reporting is on, confirmed with php -info| grep error but no output from any drush command.

Any suggestions for Windows 10?

### It works fine with Windows 10

It works fine with Windows 10. Follow these steps.

Firstly install composer with Composer-Setup.exe. Make sure your php has php_openssl enabled.

Once done go to command prompt run the following command

composer global require drush/drush:7.*

Afterwards and the path of drush to the global environment variable. Mine was

C:\Users\sukh.singh\AppData\Roaming\Composer\vendor\drush\drush

Once done, logout from the PC and re-login. That is it, now go to the drupal root folder and check with command drush status

### Works for me too but some path change was required.

Thanks @sukh.singh!

Your method works for me but when I ran for example "drush cc all" I was getting next warning: "No Drupal site found, only 'drush' cache was cleared.".

Solution was to add MySQL into the environment variable. In my case, path was "D:\xampp\mysql\bin".

Regards,
Michel.

### Drupal 8

To use this solution in Drupal 8:
Execute steps 1 and 2.
Open the Cygwin terminal and use
cd <windowsPathToYourDrupalSiteDirectory>
Curl https://drupalconsole.com/installer -L -o drupal.phar
Use Php drupal.phar list to see all the console commands

Fab

### Works, but get weird output

First of all, thank you so very much! I just spent a good 3 hours trying to get drush working for a Drupal 8 site.

Your answer worked wonderfully except that I get some weird output to the console:

←[30;42m
←[39;49m
←[30;42m [OK] Checks passed.
←[39;49m
←[30;42m
←[39;49m

// settings:set

←[30;42m
←[39;49m
←[30;42m [OK] Setting checked was set to true
←[39;49m
←[30;42m
←[39;49m



Any Idea why this might be or how to resolve it?

### Drush for D8 ?

That's why I don't want to install Drush. I use Drupal Console.
See if it is the best practice.
Best regards.

### Drush version 8 for Drupal 8

Is there easy way to install Drush 8 for drupal 8 on Windows? We have Drush-6.0-Installer-v1.msi for drupal 7 , It seems there is no such installable msi/exe for drupal 8,can i use drush.phar file?
we have drush 9 also here: https://github.com/drush-ops/drush/tags ,is it for drupal 9?

### Now, Drush needs composer so...

This is an example of installation or Composer and Drush on Windows. I hope it will help :

1. Be sure tha php command wwrks well in WIndws commands board.
2. create a directory "composer" in c:\
2. Find composer.phar file and copy it in c:\composer. You can find composer .phar on https://getcomposer.org/composer.phar
3. create a composer.bat file in directory c:\composer
4. In composer.bat file, write the commands, and replace the path to composer.phar.

@echo off
if "%PHPBIN%" == "" set PHPBIN=C:\path\to\PHP\executable\dir\.\php.exe
"%PHPBIN%" "C:\path\to\composer.phar" %*


Other code for composer.bat:

@echo OFF
SET SUBDIR=%~dp0
path\to\php.exe "%SUBDIR%/composer.phar" %*


5. Go to Environment variables in Windows and add the path "c:\composer" to be able to use the command "Composer" in Windows commands board.
7. Open Windows commands and write the next command

composer -v


If Windows returns version number, and no error, then you can go on
8. In Windows commands board, write the command

composer install


8. Install Drush by writing:
composer global require drush/drush:7.*
9. composer global require drush/drush:7.*
10. Go to Environment variables in Windows and add the path to drush.bat (parent directory) to be able to use the command "Drush" in Windows commands board.
12. try Drush commands with a command line as drush cc all

### Hello Fabul,

Hello Fabul,

Nice tutorial, but to me it does not work and I do not know what is wrong.
I disinstallto everything, including XAMPP and reinstall the xampp-win32-7.0.5-0-VC14-installer.exe version of XAMPP with PHP 7.
I followed the directions:
I created the folder C: \ composer
I copied the composer composer.bat file folder, with these indications
@ Echo off
if "% PHPBIN%" == "" set PHPBIN = C: \ XAMPP \ php \ php.exe
"PHPBIN%%" "C: \ composer \ composer.phar"% *
inserted in the path of environment variables C: \ composer

From the command prompt I position it in the composer folder and execute composer -v, but returns me the error is not recognized as an internal or external command, operable program or batch file

I checked and composer is not installed

What am I doing wrong?

thank you

Gaetano

### Composer.bat

Hi,

This is the content of the file composer.bat I had to adjust on a computer because of proxy.

PHP path is already known because it's defined as an environment variable in Windows (Computer / Properties / Environment variables)

@echo OFF
SET SUBDIR=%~dp0
php "%SUBDIR%/composer.phar" %*

I hope it will help.

Best regards

### I have no proxy.

I have no proxy.
If I use the windows installer then I can continue with the installation?
You need to insert something in your path?

Would you please write exactly the code you use in composer.bat ?
I would like to understand.

### @ echo off

@ echo off
if "%PHPBIN%" == "" set PHPBIN = C:\XAMPP\php\php.exe
"%PHPBIN%" "C:\composer\composer.phar" % *

thank's

### You can try this code

This code works for me (with wamp path). I've adapted it with your path.

@echo OFF
SET SUBDIR=%~dp0
C:\XAMPP\php\php.exe "%SUBDIR%/composer.phar" %*


### After the change of the

After the change of the content defile composer.bat, returns me the error, but does not give me 'the indication of the version as well as a tutorial, but the composer help.
I tried the composer install command, it says it can not find the file .json.
I went on getcomposer.org site, but I have not figured out how to create the .json files and what to write to them.
I thought I had done something wrong and I run the installer file for Winodws, but the result does not change.
The .json file name must have and what should I write to them?
thank you

### composer -V with UPPERCASE

To control composer version, -V is uppercased.

Then, if you read this message:

C:\>composer self-update
You are running composer with xdebug enabled. This has a major impact on runtime
performance. See https://getcomposer.org/xdebug

[RuntimeException]
The openssl extension is required for SSL/TLS protection but is not availab
le. If you can not enable the openssl extension, you can disable this error
, at your own risk, by setting the 'disable-tls' option to true.

self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [-
-stable] [--preview] [--snapshot] [--] [<version>]


THen find wich php.ini is read and enable php_openSSL extension.

I have corrected a mistake. You can return to https://www.drupal.org/node/594744#comment-11111917. The 8th path can't be used.

### Fabul you're right, I tried

Fabul you're right, I tried it with a capital letter and it worked.
I have corrected a mistake. You can return to https://www.drupal.org/node/594744#comment-11111917. The 8th path can not be used.
where it is written to run the command:
Install Drush by writing:
composer global require Drush / Drush: 7. * and ran Now I just have to enter the path of Drush and see if funiona.
I'll let you know soon
Meanwhile thanks

### Good job Gae58

I'm expecting about the end of the installation...
Bye

### I know I've done something

I know I've done something wrong.
composer -V works
I wrote the command:
composer global require Drush / Drush: 7. *
but it takes me a message, in which he tells me to change the folder and hao did.

### Composer-Setup.exe for Windows

anyway
>composer -V gives the output "Composer version 1.1.1 2016-05-17 12:25:44"
>php drupal.phar gives the output "Drupal Console (1.0.0-alpha2) | Supports Drupal (8.1.x) | Current Drupal (8.1.0)"

### Just Another way to install composer

Hi,
That's another way to install composer because in some case, I'v had some trouble with composer-setup.exe.

### Thanks for providing a nice

Thanks for providing a nice Windows installer, but it would be nice if it allowed specifying the install-library like most other applications do. I know I could have done the install by hand, but that IS painful and time-consuming.

regards,
DJ