Install wp-cli on windows

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser.

So I am going to tell you short, simple and easy way that how to use wp-cli on windows system.

Step 1: Create folder named “bin” at location “C:\Users\USERNAME\bin”.

Step 2: Download wp-cli.phar and put this file into “bin” folder ( created in step 1 ).

Now let’s go to next step. Yehh!!!!! still some steps are remaining. So now we will create a bat file for wp command.

Don’t know to create bat file ? Don’t worry it’s ok if you don’t know something… See this for how to create bat file.

Step 3: After creating that file rename it to “wp.bat” add the following code into that file.

@ECHO OFF
SET BIN_TARGET=%~dp0/./wp-cli.phar
php "%BIN_TARGET%" %*

Step 4: Now go to Control Panel -> System -> Advanced System settings ( left sidebar ) and click on “Environment variables” and then chosse “PATH” from user variables and click edit.

systemsettings          ->         uservariables                                                                         variables

 

Step 5: Now add two paths into Variable values at value. 1st is PHP path ( where your php is installed. ). In my case it’s ;D:\xamp\php and 2nd is your wp-cli path ( we created in step 1 ) which is ;C:\Users\bunty\bin.

Final value will be like this:

C:\Users\bunty\AppData\Roaming\npm;C:\Users\bunty\AppData\Roaming\Composer\vendor\bin;D:\xamp\php;C:\Users\bunty\bin

Now we will check if it works or not. But before this you need to restart your PC and follow next steps.

Open cmd ( hopping that you all have different method to open it… ) and go to “C:\Users\USERNAME\bin” location by the following command:

cd C:\Users\USERNAME\bin

and after that run following command 

php wp-cli.phar --info

Hope you will get output something like this:

cmd

Awwwww…!!!!!! feels good right….!!!!!!!

Feeeeewwww…!!!!!!! this is too much right..?!!!! But cooool, you did it. Yes, you have completed the installation now. the only thing is need rightnow is just test it. To check and see whether WP-CLI is set up properly, execute the following line on the command prompt:

wp --info

And you will get same result as step 2 like this:

wp-cli

Finally it is done. Now you can use wp-cli commands. Now in cmd, just go to root of your WP installation and run following command:

wp plugin install bbpress --activate

And tell me what happens…..? I am not gonna tell you..!!!!! You tell me…..!!!!!!!

That’s it…

Advertisements