• Aug 29, 2022

Install WP-CLI on Windows

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

Or you can do it using command.

C:\> mkdir C:\wp-cli
C:\> cd C:\wp-cli
C:\> curl -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar 
  • 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"

Check php version:

php -v

Check mysql version:

mysql -V

You can now use WP-CLI from anywhere in Windows command line.

wp cli version
wp-cli verison