Community Documentation

Installing Drush on Windows

Last updated February 8, 2012. Created by johnbarclay on October 3, 2009.
Edited by cossovich, juampy, greg.1.anderson, kurkuma. Log in to edit this page.

There is a convenient Drush installer for Windows available on drush.ws. Please see the installation guide available there, or follow the instructions below to install the hard way (possibly useful if you have trouble with the installer).

The drush readme.txt file contains the basics of installing drush. Some special considerations need to be made when installing on windows. This Tutorial is for Drush 5 and based on the process outlined at: http://drupal.org/node/330023

Step by Step

  1. Open http://drupal.org/project/drush and download and extract "All-versions-5.x-dev" to C:\ so drush.bat can be found at C:\drush\drush.bat.
  2. Install the following external applications.
  3. Use bsdtar for tar. Its more reliable. Copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe
  4. Set PATH environment variable to include drush, php, and binaries installed above.
    add something like this line to the end of the current value
    ;C:\php;C:\drush;C:\Program Files\GnuWin32\bin
    The semicolon separates the paths. Paths are those to: php.exe, drush.bat location,and tar/gzip/wget binaries. You will need to reopen your shell/command prompt window to have the path variables refreshed.
  5. Open the Command Prompt, type "drush status" and hit enter. You should see the following output:
      PHP configuration      :  C:\php\php.ini
      Drush version             :  5.0-dev
      Drush configuration   :
      Drush alias files         :

    If you did, installation is complete. If not, keep on reading.
  6. This step may no longer be needed. See comments.
    Now you need to locate your drush.bat file which is located in the root directory of your drush module
    "C:\path-to-drush\drush.bat".
    Open this file and append the full path to the drush.php file:
    c:\php\php.exe C:\drush\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9
    For drush-2.1/3.1:
    You just need to put the full path to php, no need to put the full path to drush:
    c:\php\php.exe "%~dp0drush.php" %1 %2 %3 %4 %5 %6 %7 %8 %9

Other How Tos for Installing Drush on Windows

Gotchas for Windows

Install Script

Notes below Will be converted into batch install script

# install gzip, tar, wget command line binaries
# download drush.  Using c:\drush as location in this example
# set PATH environment variables
# edit drush.bat

Above Directions Work on...

  • Windows server 2008. R2 Tested by: johnbarclay (11/14/2010)
  • Windows server 2008. Tested by: johnbarclay (10/2/2009)
  • Windows Vista 64-bit Business. Tested by: Gman (10/20/2009)
  • Windows Vista 32-bit Business. Tested by: buckley (2010-01-10)
  • Windows Vista 32-bit Home Premium. Tested by: decibel.places (2010-10-27)
  • Windows XP SP3 32-bit. Tested by: phoenix (10/23/2009)
  • Windows 7 Home Premium 32-bit. Tested by: azovsky (06/29/2010)
  • Windows 7 Enterprise 64-bit. Tested by: kurkuma (02/07/2011)

Other tutorials on this topic

Comments

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

%* 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
i get an alert saying libssl32.dll not found
It didnt work even after installin .dll file

Windows 7 64 bits with IIS 7.5

A little variation that works for me.

1. Added path

;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.

Do not forget the dependencies!

If you download the zip versions of the binary packages, do not forget to download the dependencies as well.

when I open the bat file I

when I open the bat file I just get @echo off
REM See http://drupal.org/node/506448 for more information.
@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]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

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 username             :  drupal70
Database name                 :  d70
Database                      :  Connected
Drupal bootstrap              :  Successful
Drupal user                   :  Anonymous
Default theme                 :  bartik
Administration theme          :  seven
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 for your help

Thanks for your help

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)

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).

How to install Drush in Windows 7?

With drush we can deeply decrease the quantity of time needed to setup.
You can contact iGennie for best technical support with Drush or the Drush Windows installer.
For any query you must visit
http://www.igennie.net

Works on Windows 7

Works on Windows 7 Professional 32-bit.

Thanks!

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.

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 5.x, Drupal 6.x, Drupal 7.x
Audience
Developers and coders, Site administrators
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here