Reputation: 3804
I recently installed WP-CLI on windows with the instructions below. However when I type wp shell I get an error:
The system cannot find the path specified.
One solution on github says:
Psysh is not bundled in wp-cli.phar, but you should be able to include it, like so:
wget psysh.org/psysh -O psysh.phar php wp-cli.phar --require=psysh.phar shell
however, that also produces an error:
'wget' is not recognized as an internal or external command, operable program or batch file.
Please help! I'm too far down the rabbit hole. I wanted to use WP CLI to make my life easier!
Installation instructions followed (from http://wp-cli.org/docs/installing/):
Installing on Windows# Install via composer as described above or use the following method.
Make sure you have php installed and in your path so you can execute it globally.
Download wp-cli.phar manually and save it to a folder, for example c:\wp-cli
Create a file named wp.bat in c:\wp-cli with the following contents:
@ECHO OFF php "c:/wp-cli/wp-cli.phar" %*
Add c:\wp-cli to your path:
setx path "%path%;c:\wp-cli"
You can now use WP-CLI from anywhere in Windows command line
Upvotes: 1
Views: 3012
Reputation: 815
The wp shell
command requires a library called psysh
to work properly on Windows. While there are suggestions out there to get it work by installing the psysh library globally (also mentioned in the question), I didn't like the idea of having to install a global dependency to composer for just one library. While this worked fine, it felt a little too much like an anti-pattern to me.
Instead I forked wp-cli-bundle to create a version of wp-cli.phar
which has psysh
built in so wp shell
will work on Windows.
This fork also has a few other Windows related enhancements. See the Readme.md for the current list.
You may download that latest wp-cli.phar here or previous versions from the Releases section.
Upvotes: 2
Reputation: 3899
You seem to be mixing the instructions for installing WP-CLI via Composer with the instructions for installing manually. You need to stick with one or the other. I remember following the manual installation instructions and everything went fine. Follow just those instructions. Forget about Composer for now.
wget
is a Unix program and does not work on Windows without specifically installing it. Don't use it for this installation.
It sounds like either WP-CLI
or PHP
is missing from your global path. Follow the instructions at http://php.net/manual/en/faq.installation.php#faq.installation.addtopath to ensure PHP is executable globally. Specifically the following:
Go to Control Panel and open the System icon (Start → Control Panel)
Go to the Advanced tab
Click on the 'Environment Variables' button
Look into the 'System Variables' pane
Find the Path entry (you may need to scroll to find it)
Double click on the Path entry
Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)
Press OK
Do the same for the path to the WP-CLI
executable. Result should look somewhat like my own PATH below.
Upvotes: 2