About Drush

Drush is an awesome shell interface for managing Drupal right from your cloud server command line. It is a very useful tool as it helps you perform various admin tasks using just one or two commands in the terminal, replacing the need for many clicks and page refreshes in the UI. This command line interface that allows to manage your Drupal web sites fast and easy.
Here we have two ways to install Drush on windows, many people prefers using installer and some likes using command line both are as below.
A) Install Drush on Windows – The easy way by using Installer.

Follow the Windows-specific instructions provided on Github:
http://docs.drush.org/en/master/install/#windows-zip-package

You should find a link to a Windows installer there. Here is the current link (as of 28 January 2015):
https://github.com/drush-ops/drush/releases/download/6.0.0/Drush-6.0-201…

The Windows installer is compiled and managed separately from the rest of the Drush github repository, and so you should not be surprised if the MSI installer version offered does not quite match the latest version of Drush.

As of September, 2014, the Drush 6 Windows installers works well on Windows XP, Vista, 7, and 8. This is the recommended method for installing Drush on Windows. It is is much simpler than the manual processes described below.

B) Install Drush on Windows – The hard way by using command line.

Below are the steps to install Drush 7 on Windows. These are tested instructions on both Windows 7 and 8 and using both XAMPP and Wamp.:

You can install Composer by downloading the Windows Composer installation program, which can be found at https://getcomposer.org/Composer-Setup.exe. The Composer installation program installs it’s programs into a hidden directory called C:\Users\[yourusername]\AppData\Roaming\Composer

After you have installed Composer, please open up a NEW command (cmd) or git bash window and enter the following command:

composer -V

If you get a version, woohoo you are up and running!. If you get the error message:
sh.exe”: composer: command not found in a (git bash windows) or
‘composer’ is not recognized as an internal or external command ….(in a Cmd windows)
Please note: you can NOT use an command or git bash windows that was opened before you did the Composer installation. You must open a new command or git bash window as the Composer installation updates your environmental variables. Windows will only sets the environmental variables when you open a new command or git bash window.

If the above version command does not work, then something went wrong with the Composer installation. You will need to figure out the issue, resolve it, and re-install.

Once Composer is installed, please enter the following command in your cmd or git bash window:
composer global require drush/drush:dev-master
This command should start the drush installation process. After you run the install, please check the hidden directory \AppData\Roaming\Composer\Vendor to see if Drush is there.

Now we need to determine if drush was installed. You can do this by entering the following command in your command or git bash window:
drush status
if drush is installed correctly, you should receive a message something like:
PHP executable : php
PHP configuration : C:\Sites\bin\php\php5.5.12\php.ini
PHP OS : WINNT
Drush version : 7.0-dev
Drush temp directory : C:/Users/Owner/AppData/Local/Temp
Drush configuration :
Drush alias files :

If you do not get the above message and drush is in the vendor directory of
C:/Users/[user name]/AppData/Roaming/Composer/vendor/drush/drush
then the most likely issue is the environmental variable PATH was not updated. When you check your PATH variable, it should contain that above path. If not, then you will need to manually add the path to your environmental variables.Once you have manually updated your PATH variable, and closed and re-opened your command or git bash window, then please try the drush status command again.
You should see a message with the version. Yay! You are almost there.

. Now you have to test your Windows set up to see if it has all the stuff drush needs. Using your existing command or git bash window, please change directory to your web site directory and attempt to use drush to download a current version of Drupal. In my case, I do this by entering the following command in my git bash window:

cd /c/Sites/www
drush dl drupal

If the current version of Drupal is downloaded into the proper directory with all of the appropriate sub-directories, then you are DONE!

If you receive any error message at the command prompt, of if you get a message about wget missing, or if the files were not downloaded correctly, you may need to install some more applications and or libraries.

In order for Drush to work, I had to download a few more things. I had Drush installed and did drush dl drupal and it wouldn’t save, untar, or do anything. I finally figured out that I needed a few more things:
LibArchive: http://gnuwin32.sourceforge.net/packages/libarchive.htm

GZip: http://gnuwin32.sourceforge.net/packages/gzip.htm

WGet: http://gnuwin32.sourceforge.net/packages/wget.htm

Ninja Girl also suggests: Use bsdtar for tar, it’s as it is more reliable. Please copy the file C:\Program Files\GnuWin32\bin\bsdtar.exe to C:\Program Files\GnuWin32\bin\tar.exe. Please read http://drupal.org/node/594744 for more details

Ninjagirl also provided another piece of the puzzle with her article Drush on Windows . The default location for these three files will be in C:\Program Files (x86)\GnuWin32\bin. You will need to manually add that path to the environment variable PATH.

Also, please make sure that the drush.bat file was looking for php.exe in the right place.

After I installed XAMPP, Composer, and Drush, the PATH environment variables should include the following paths:
(Your path may point to different directory depending on how you installed the different programs.)
C:\Ruby193\bin;C:\Users\admin\AppData\Roaming\Composer\vendor\drush\drush;C:\Program Files (x86)\GnuWin32\bin;C:\xampp\php;C:\xampp\mysql\bin

Find some helpful drush commands

References :

http://drupalistasgroup.com/installing-drush-7-windows-xampp

https://www.drupal.org/node/594744

https://www.digitalocean.com/community/tutorials/a-beginner-s-guide-to-drush-the-drupal-shell

Advertisements