You can use WP-CLI tool with wp-cli.phar file and assign wp alias so you don’t have to type full phase everytime . It all depends on the installation type you will run. To use wp alias use the fallowing installation instruction:

mkdir C:/bin
cd C:/bin # cd to destination dir included in WINDOWS VARIABLE PATH
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# alternatively you could use wget instead of curl
# wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

You could also download a wp-cli.phar through http, place it in C:/bin. Next add bin folder to Windows PATH. As in WP documentation you can also do this through cli command but do not!!!!! This would brake clear your USER PATH and leave it with %path% and c:\bin only…

# BACKUP PATH BEFORE EDITING!!!
# DO NOT RUN THIS IN GIT-BASH!!!! USE WINDOWS CMD INSTEAD!!! >>>>>>> 
setx path "%path%;c:\bin"
# I STRONGLY RECOMMEND TO DO IT MANUALLY INSTEAD

Now in the bin folder create vim wp.bat file and paste there this code:

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

The above will work in Windows CMD but not in git-bash. To make wp command work in git-bash you need to do the fallowing:

When you open the git bash type in the command touch .bash_profile. Following this type vim .bash_profile. You can then add your aliases to this file. Save the file and reopen the git bash and your aliases should work as expected.

Alternatively run the fallowing command:

cd ~
touch .bashrc
echo -e "alias wp='wp-cli.phar'" >> .bashrc
echo -e "alias wp='wp.bat'" >> .bashrc

Or use any other text editor like vim and type alias wp='wp-cli.phar' inside the .bashrc file. Restart terminal. You should can see a notice that there are missing conf files and they will be generated now. Next time you lunch terminal this notice will be gone.

https://make.wordpress.org/cli/handbook/contributions/pull-requests/
https://make.wordpress.org/cli/handbook/guides/installing/#installing-on-windows
https://stackoverflow.com/questions/13715179/my-git-bash-forgets-my-aliases-what-can-i-do
https://askubuntu.com/questions/21555/command-to-append-line-to-a-text-file-without-opening-an-editor

0
Would love your thoughts, please comment.x
()
x