WP-CLI is a tool for controlling WordPress through a console window.

Although it is said that wp-cli requires UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) environment however it is still possible to install in Windows environment.

Following are the requirements you should be prepared before begin with wp-cli installation.

1. Install Composer

Download and install the Composer . It will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line.

To verify composer installed successfully, try checking its version. for e.g.

C:\Users\username>composer -V
Composer version 1.0.0 2016-01-10 20:34:53

composer

2. Install PHP

You probably have XAMPP already installed in your system that already installed the PHP environment.

To verify PHP exist in your system, try checking its version. for e.g.

C:\Users\username>php -V

php

3. Begin install WP CLI

Once above set up are completed, download phar file.

Let’s say you want to install wp-cli in your F: drive, you just go and place this phar file in a logical path F:\wp-cli\wp-cli.phar . Now create a new batch file wp.bat in the same directory, this will act as an alias for the phar file. Inside wp.bat file paste the following contents and save.

@ECHO OFF
php "%~dp0wp-cli.phar" %*

4. Set environment variable

Go to System’s Properties -> click Advanced System Properties -> select the tab labeled Advanced. Click Environment Variables, under the System variables section scroll down to the variable named Path and add ;C:\wp-cli

environment

 

Exit all CMD’s (or git bash) and reopen them. Now go to one of your WordPress installs and type wp core version. You should get the WP version.