0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
JPPINTO
  • Home
  • Blog
  • Certifications
  • About
  • Contact
  • Shop
  • Gallery
  • Current Setup
Contact

Search

June 23, 2026 / Windows 10, WordPress, WP-CLI

Install WP-CLI on Windows and Run Basic WordPress Commands

Tags: install wp-cli, powershell, windows, wordpress, wordpress command line, wp-cli
Featured image for Install WP-CLI on Windows and Run Basic WordPress Commands

WP-CLI lets you manage WordPress from the command line. On Windows, it is useful for checking a site, listing posts, reviewing plugins, importing media, and running small maintenance helpers without opening the browser for every task.

What It Does

  • Installs the WP-CLI Phar file in a reusable Windows folder.
  • Adds a small wp.bat wrapper so the wp command works from PowerShell.
  • Shows how to point WP-CLI at a WordPress install with --path.
  • Gives basic examples for posts, plugins, themes, categories, media imports, and helper scripts.

Requirements

WP-CLI needs PHP available from the command line. Before installing WP-CLI, confirm that PowerShell can find PHP:

php -v

If that command is not recognized, install PHP or add the existing PHP folder to the Windows Path environment variable first.

Download WP-CLI

Create a folder for WP-CLI and download the Phar file:

New-Item -ItemType Directory -Path C:\wp-cli -Force
Invoke-WebRequest -Uri https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile C:\wp-cli\wp-cli.phar

Test the Phar directly with PHP:

php C:\wp-cli\wp-cli.phar --info

Add the wp Command

Create a small batch wrapper named wp.bat:

Set-Content -Path C:\wp-cli\wp.bat -Value '@php "%~dp0wp-cli.phar" %*'

Add C:\wp-cli to the Windows Path environment variable, then open a new PowerShell window and test:

wp --info

Point WP-CLI at a WordPress Site

When the terminal is not inside the WordPress folder, use --path with the WordPress install path:

wp --path="C:\inetpub\sites\example.com" core version

The --path value should point to the folder that contains wp-config.php, wp-admin, wp-content, and wp-includes.

Basic WP-CLI Examples

List posts:

wp --path="C:\inetpub\sites\example.com" post list --post_type=post --fields=ID,post_title,post_status,post_date

List plugins:

wp --path="C:\inetpub\sites\example.com" plugin list

List themes:

wp --path="C:\inetpub\sites\example.com" theme list

List categories:

wp --path="C:\inetpub\sites\example.com" term list category --fields=term_id,name,slug,count

Import an image into the Media Library:

wp --path="C:\inetpub\sites\example.com" media import .\assets\example-screenshot.png --title="Example screenshot"

Run a PHP helper script:

wp --path="C:\inetpub\sites\example.com" eval-file .\path\to\helper.php

Common Path Mistake

The folder where you keep helper scripts is not always the WordPress install. For example, a source repository can be in C:\DevOps\DEV-Site, while WordPress is installed in C:\inetpub\sites\example.com.

In that case, run WP-CLI from the source repository but point --path at WordPress:

Set-Location C:\DevOps\DEV-Site
wp --path="C:\inetpub\sites\example.com" eval-file .\.codex\scripts\sync-posts-from-posts.php

That pattern lets WP-CLI load WordPress correctly while still running a helper script stored outside the WordPress folder.

Post Views: 50
<- Make Sure PowerShell Scripts Can Run on Windows
Move WordPress Articles from Dev to Production with WP-CLI ->

Categories

  • Active Directory (5)
  • AI (3)
  • Amazon Cloud Services (1)
  • AWS (2)
  • Blazor (1)
  • C# (C-Sharp) (3)
  • CI/CD Pipelines (1)
  • Cloud (1)
  • Cloudflare (2)
  • Codex (1)
  • Containers (4)
  • Deployment (2)
  • Development (5)
  • DNS (1)
  • Docker (3)
  • Email (1)
  • Family (1)
  • General (5)
  • IIS 6.0 (4)
  • IIS 7.0 (10)
  • IIS 8.0 (1)
  • Infrastructure as Code (IaC) (1)
  • Kubernetes (3)
  • Linux (9)
  • Microsoft 365 (2)
  • MySQL (1)
  • Office 2010 (1)
  • PHP (1)
  • PowerShell (11)
  • Productivity (1)
  • Security (1)
  • Servers (9)
  • SharePoint 2007 (8)
  • SharePoint 2010 (19)
  • SharePoint 2013 (2)
  • SharePoint Online (1)
  • SMTP (4)
  • SQL Server 2008 (1)
  • SQL Server 2008 R2 (1)
  • SQL Server 2012 (2)
  • SQL Server 2019 (1)
  • SSL (1)
  • Travel (1)
  • Troubleshooting (1)
  • Ubuntu (9)
  • Uncategorized (1)
  • URL Rewrite (2)
  • Visual Studio 2019 (1)
  • Visual Studio Code (1)
  • Windows 10 (7)
  • Windows 2003 (9)
  • Windows 2008 (18)
  • Windows 2012 (6)
  • Windows 7 (3)
  • Windows Firewall (1)
  • Windows Vista (1)
  • WordPress (3)
  • WP-CLI (3)

Recent Posts

  • GPT-5.6 Sol Changes How We Prompt—and How We Write AGENTS.md
  • Protect a Domain That Does Not Send Email with SPF, DMARC, and Null MX
  • Turning Our Atlanta Vacation Photos into a Video with PowerShell
  • Bulk Create Cloudflare Origin CA Certificates with PowerShell
  • Test a Cloudflare Global API Key Connection with PowerShell

Advertisement

Tags

agents.md ai coding agents aws bash cloudflare cloud storage codex context engineering developer workflow dev to production dns externalize blob externalize sharepoint data full installation http redirect https IIS IIS installation index server configuration installing cumulative updates linux load balance central administration microsoft 365 nginx powerpoint powershell redirect http to https s3 server setup sharepoint 2010 cumulative updates sharepoint 2010 farm build sharepoint 2010 farm configuration sharepoint 2010 farm installation sharepoint data externalization SMTP ssl storagepoint ubuntu web server windows Windows 7 windows server 2008 wordpress wp-cli x86
© 2026 JPPinto.com. All rights reserved.