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\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]