How to set up WP-CLI?

WPCLI (WordPress Command Line Interface) is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.

Download the phar from Put it where you want.

add that directory to the environment variables

add a file called wp.bat within that directory with the following content:

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

Final step: in order to avoid using wp.bat on the command line put another file called wp (without any extension) in the same directory. In that file insert the following:

wp.bat $@

Thats it! now you can use the wp cli from anywhere. Tested on git bash and power shell on windows.

Leave a Reply

Your email address will not be published. Required fields are marked *