Using Drush ( Power tool for Drupal ) in Windows XP

At first when I saw drush i thought it’s not that handy as it seems to be. I thought some geek created this just to have fun and feel command line flexibility. But after i dig deeper i found it amazing. If you understand how to use drush you will be amazed by it’s power.

Now what is drush .. drush is a command line shell and Unix scripting interface for Drupal. as stated in here.  The most noteable features of drush from my point of view is :   module enable/disable, update script,  module download, cache clear. Just from command mode i can check latest version of module and dl them and enable them in just simple 3 to 4 commands.

I am not going to briefly explain drush functionality but will try to explain how to run drush in your system in this case Windows XP ( 😛 ) .  Here it goes:

  • Download the latest version of drush from drupal
  • Now open Command prompt and check and set initial settings.
    • Type ‘php’ and press enter if php command is not found then set php.exe path in your Environment
    • Also add the drush path into the environment path
    • By Closing and opening  command prompt again. check by typing ‘drush’
    • If by typing ‘drush’ shows error regarding drush.php open drush.bat file in an editor and  add the abosulute path of drush.php in that bat file.
    • This will fix the drush.php path problem.
  • Let’s play with drush. Open command prompt again and traverse to a drupal installation for example:  ‘cd d:/www/mydrupal’  and then type  ‘drush status’. It will show initial settings of mydrupal installation. If it does not check for settings and environment path.

Drush has some nice extensions. You can play around with them. Here is another simple tip for you. If you study drush you will definately like “drush -v dl ” and ‘drush info” command. “drush info <module_name>” shows particular modules downloadable version and “drush -v dl” can help you to download and copy the file directly into your installation by just 1 single command. But to use ‘drush -v dl’ is little tricky. It uses gzip and tar command to extract the downloaded module file. You can download gzip and tar exe for windows from here.

It seems some ppl did able to use gzip and tar without any hasle but in my case i had trouble with tar. So i hacked into the core of drush and changed the tar command into izarce . If you face problem with tar then go with izarce. It worked for me.

Oops. To use izarce first install the command line version. Then add the izarce location into your environment path. THen goto drush directory and open file ‘drush\commands\pm\package_handler\’.  Now find the line which says:

drush_shell_exec(“tar -xf $tarpath -C \”$path\””);

Now replace this with

drush_shell_exec(“izarce -e -d -p”. $path . ” $tarpath”);

It worked for me hope this does for you too. Have a nice drushed life.

[ N.B. At first i tried to use 7zip instead of izarce and gzip+tar but they have some absolute path issue; the solution of which i could not find. So, if you do know of any solution better than this do let me know.

For setting environment   press “windows key+ pausebreak” >> Advanced >> ‘environment variable’ >> now find variable path .. 🙂 enjoy]


12 thoughts on “Using Drush ( Power tool for Drupal ) in Windows XP

  1. tohin says:

    can u plz check the code in drush_pm_download()??? .. and i have not seen such errors before.. Have you followed the procedures ?

  2. maykbrito says:

    Yto.. I’m getting same error. (under windows seven)
    I am still waiting for some solution at issues on the module’s page.
    (just subscribing)

  3. Yto says:

    Yes tohin i folow the procedure. I trie in my xp sp3. I use wamp whith php 5.2.11. I Will retry the procedure on another pc.
    Thanks yto

  4. tohin says:

    @YTO I think some other issues are there.. cause the time i was using drush it was XP SP3 and php version was same ..

    at present i am using win7 and haven’t put drush in it yet .. Tonight will give it a go. Will let you know the update ..

  5. Adrian says:

    C:\wamp\www\d6dev>drush –uri=http://dev6.localhost info
    Command pm-releases needs the following modules installed/enabled to [error]

    run: update.
    The drush command ‘info’ could not be executed. [error]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s