# 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:

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

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\wget.inc’.  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. pablo says:

very useful!!
thank you

2. paranojik says:

Using 7z like this
drush_shell_exec(“7z x -o\”$path\”$tarpath”);
worked for me.

3. tohin says:

I will take a look on this.. @paranojik .. thanks for sharing .

4. 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 ?

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

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

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

8. abe says:

This issue is resolved here http://drupal.org/node/594744. I replaced tar.exe with bsdtar.exe and it worked flawlessly for me in Vista. No code change required in wget.inc.