As you most likely already know, WP-CLI is the official command line tool for interacting with and managing your WordPress sites. It can be used for a number of different reasons, from installing and updating the WordPress core, to managing plugins and themes, and so on. In this brief tutorial we’ll explain how to install the WP-CLI on Windows using two methods: composer or a phar+bat files combo.
Install using Composer
To install the WP-CLI using composer, we strongly suggest to read this official guide from make.wordpress.org.
Install using PHAR+BAT files
To install WP-CLI using a plain batch file, follow these steps:
- Make sure you have php installed and in your path so you can execute it globally.
- Download wp-cli.phar manually from here and save it to a folder, such as c:\wp-cli
- Create a file named wp.bat in c:\wp-cli with the following contents:
php "c:/wp-cli/wp-cli.phar" %*
The last thing you need to do is to add c:\wp-cli to your path. You can either do that from the Command Panel (System > Advanced) or by executing the following CMD:
setx path "%path%;c:\wp-cli"
You can now use WP-CLI from anywhere in Windows command line.