Install Drush on Windows - The easy way.
Note: There is an issue with the Drush Installation Guide instructions. The section entitled "Register Environment Variables" is seriously out of date. The environmental variable maximum length limitation of 2047 characters applies to Windows 2000 and NT. The maximum length of the environmental variable was increased to 8191 characters in Windows XP. Summary: Windows XP and forward has a 8k limitation on the size of the Path environmental variable, so this is not an issue anymore. For more information on this, please read 8k limitation on Path in XP / W7 - 2k in Windows 2000.
As of October, 2012, the Drush Windows installers works well on Windows XP and 7. From a user's standpoint, I would highly recommend that you use the above referenced Drush Windows Installer. It is is much simpler than the manual process described further below.
You may also want to read the article Installing Drush on Windows XP, 7 so it runs in a Git Bash Window.
How to manually upgrade to Drush 5.x and 6.x on Windows XP and 7
Drush 5.7 Makes does not work in Windows 7 - but drush 6 does!
The Drush Make command does not work in Windows 7 / Vista, when using Drush release 5.5, 5.6, or 5.7. However, the current development version of Drush fixes this issue!
So, if you still cannot find an suitable Drush installer for your Windows version, take a look at this article, How to manually upgrade to Drush 5.x and 6.x on Windows XP and 7, which provides detailed instructions for manually installing the latest development version of Drush in Windows.
Install Drush on Windows - The hard way.
The most recent official Drush readme.txt file contains the basics of installing drush. Some special considerations need to be made when installing on windows. The following Tutorial is for Drush 5 and based on the process outlined at: http://drupal.org/node/330023
Follow the instructions below to install Drush on Windows the hard way (possibly useful if you had trouble with the installer above).
Step by Step
- 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.
- Install the following external applications.
- 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
- Set PATH environment variable to include drush, php, and binaries installed above.
add something like this line to the end of the current value
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.
or enter on the command line:
setx PATH "%PATH%;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php;C:\Program Files (x86)\Drush\cwRsync\bin;"
- 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.
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
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
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
- http://vimeo.com/15371661 - Video, Installing WAMP, Drush & Drupal on Windows 7
- Installing Drush on Cygwin: http://drupal.org/node/1432756
- Installing WAMP, Drush & Drupal on Windows 7 (Video)
Gotchas for Windows
- gnuwin32 tar problem. Gnuwin32 tar fails silently because it can not handle windows file paths correctly. In verbose mode error is visible. http://drupal.org/node/483110#comment-2109272
Configuration files (i.e. site alias files) locations
If you are using the drush.ws Windows installer and have not modified the installation paths, etc., finding where to set up your Drush alias files is challenging. The information is there, but not readily accessible. Drush will look through a sequence of directories, each less specific to a site than the other as defined in the C:\ProgramData\examples\example.drushrc.php file. In those comment, the references are for Linux based operating system. On Windows the following locations should help:
- #4, the User's .drush folder, is usually located at C:\Users\user_name\.drush. But that location is determined by the environment variables HOME or HOMEDRIVE/HOMEPATH. Double check by a SET command at the command line.
- #6, the Drush installation folder, is usually located at C:\ProgramData\Drush. In this case do not use a .drush subdirectory, put the files into the installation folder.
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 XP SP2 32-bit. Tested by: vmi (01/19/2012)
- Windows 7 Home Premium 32-bit. Tested by: azovsky (06/29/2010)
- Windows 7 Enterprise 64-bit. Tested by: kurkuma (02/07/2011)
- Windows 8 Professional 64-bit. Tested by: pvasili (10/07/201.)