admin管理员组文章数量:1279175
I have tried to install Wordpress CLI on my windows machine running windows 10. But for some reason everytime i try to run the
wp
Command it says
'sh' is not recognized as an internal or external command,operable program or batch file.
I have tried multiple times to reinstall it and set it up from scratch with different guides but it just won't work.
This is what the bat file says
@ECHO OFF
SET BIN_TARGET=%~dp0/./wp-cli.phar
php "%BIN_TARGET%" %*
This is the environment variable i am using to point it to the bat file
That is where the .phar file and my .bat file are located to run the CLI.
All help is appreciated
Regards
Jonas Bang
I have tried to install Wordpress CLI on my windows machine running windows 10. But for some reason everytime i try to run the
wp
Command it says
'sh' is not recognized as an internal or external command,operable program or batch file.
I have tried multiple times to reinstall it and set it up from scratch with different guides but it just won't work.
This is what the bat file says
@ECHO OFF
SET BIN_TARGET=%~dp0/./wp-cli.phar
php "%BIN_TARGET%" %*
This is the environment variable i am using to point it to the bat file
That is where the .phar file and my .bat file are located to run the CLI.
All help is appreciated
Regards
Jonas Bang
Share Improve this question asked Sep 28, 2021 at 9:12 Jonas BangJonas Bang 133 bronze badges 2- 1 Where did the .bat come from? I'm surprised they gave you one if it then needs sh. But it looks you'll need a unix-like environment for your Windows e.g. Git bash or WSL2. Note however the homepage says "limited support in Windows environment" – Rup Commented Sep 28, 2021 at 9:51
- have you attempted the official windows install method at make.wordpress/cli/handbook/guides/installing/…? Note that WP CLI has limited compatibility on a Windows non-Unix environment. You would be better off with a containerised/virtual environment that provides Linux, such as WSL or perhaps even git bash – Tom J Nowell ♦ Commented Sep 28, 2021 at 9:57
1 Answer
Reset to default 1Currently i have several process running in my CI/CD with wp-cli and all works fine in windows and unix. In my experience this is your best option in windows:
#1 Add PHP to your Windows Path Variable
#2 Install, as @Rup suggests, Git-bash terminal.
#3 Execute an wp-cli command like that:
vendor/bin/wp cache flush --path=public/wp-cms/wp-core
*This code consider you are using wp-cli managed with composer, and the files are locatted at vendor folder, otherwise you can replace vendor/bin/wp
with wp
本文标签: wp cliWP Cli will not execute on Windows
版权声明:本文标题:wp cli - WP Cli will not execute on Windows 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741285471a2370244.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论