WP-CLI is a command-line tool for managing WordPress websites. You can install plugins, themes, create users, and much more—all without using a browser. Follow these steps to set it up on your Windows PC with Laragon.

1. Check PHP Path

Open Laragon Terminal (Menu -> Terminal) and run:

where php

This shows the path to your PHP. Example:

C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64\php.exe

We’ll put WP-CLI in this same folder so Windows finds it.


2. Put wp-cli.phar in PHP Folder

Run these commands (adjust version number to your PHP folder name):

cd C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64
curl -o wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Now you’ll have:

C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64\wp-cli.phar

3. Create wp.bat

In the same folder (php-8.1.10-Win32-vs16-x64), create a new file named wp.bat with this content:

@ECHO OFF
php "C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64\wp-cli.phar" %*

(📌 Replace the path if your PHP version folder is different)


4. Test WP-CLI

Close and reopen laragon Terminal, then run:

wp --info

You should now see something like:

OS: Windows NT 10.0
Shell: cmd.exe
PHP binary: C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64\php.exe
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI version: 2.10.0

✅ That’s it — now wp will work from anywhere in Laragon terminal.

Leave a Reply

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