Created
July 27, 2024 10:27
-
-
Save cyberwani/3f4a2b0b0ed5775a94d47e463ea6dc70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Get the current directory | |
set "current_dir=%cd%" | |
set "wp_cli_cache=%current_dir%\cache" | |
:: Add the current directory to the PATH environment variable | |
cls | |
:: Check if the current directory is already in the system PATH | |
echo %PATH% | findstr /C:"%current_dir%" >nul | |
if %ERRORLEVEL% NEQ 0 ( | |
:: Add the current directory to the system PATH environment variable | |
setx PATH "%PATH%;%current_dir%" /M | |
cls | |
) | |
setx WP_CLI_CACHE_DIR "%wp_cli_cache%" /M | |
:: Create wp.bat in the current directory | |
echo @ECHO OFF > "%current_dir%\wp.bat" | |
echo php "%current_dir%\wp-cli.phar" %%* >> "%current_dir%\wp.bat" | |
echo Downloading "wp-cli.phar"... | |
echo. | |
:: Download wp-cli.phar to the current directory | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
:: Inform the user | |
cls | |
echo %wp_cli_cache% | |
echo WP CLI installed successfully. | |
echo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment