Find by Category

How to Install WP CLI on Windows 10

I assume that you already know what is wp-cli tool, in this post I am going to show you how to download and install wp-cli tool on Windows 10. However, if you have Windows 7 or Windows 8; these steps will work for you.

WP-CLI Prerequisites

check php and composer version with cmd.png

You need to have PHP and Composer installed and set them to system PATH. I have installed XAMPP and set PHP and MySQL to system PATH and installed Composer separately.

Please make sure that you are able to check PHP and Composer version from command line tool.

Recommended Posts

Download and Install WP-CLI for Windows

Once you have installed PHP and Composer and set them to system PATH;

  1. Download wp-cli.phar
  2. Create a folder c:\wp-cli
  3. Copy and Paste downloaded wp-cli.phar file in c:\wp-cli
  4. Create a named wp.bat in c:\wp-cli folder
  5. Paste the following code in wp.bat file and save wp.bat file

wp.bat

@ECHO OFF
php "c:/wp-cli/wp-cli.phar" %*

Set c:\wp-cli to your system PATH

From Windows Menu, open Environment Variables and select Path and click EDIT and ADD new environment variable and hit ok, ok, and ok.

Relaunch CMD & Type wp help

WP CLI Commands

Now you can run wp cli commands to manage WordPress sites and scaffold plugins, blocks, and themes. Now, install WordPress on Windows, navigate to your WordPress installation directory and try the following wp cli commands.

  1. wp scaffold plugin plugin_name
  2. wp plugin install user-switching –activate
  3. wp cli version
  4. wp scaffold _s theme-name
  5. wp scaffold post-type books
  6. wp scaffold block movie
  7. wp scaffold child-theme xyz_child parent_theme=xyz

For more wp-cli commands visit official docs’ page

2 thoughts on “How to Install WP CLI on Windows 10”

Comments are closed.