Skip to content

Instantly share code, notes, and snippets.

@Rodrigo54
Last active April 14, 2018 19:05
Show Gist options
  • Save Rodrigo54/4c06d17e03eac5724fcd2d599341cf44 to your computer and use it in GitHub Desktop.
Save Rodrigo54/4c06d17e03eac5724fcd2d599341cf44 to your computer and use it in GitHub Desktop.
@REM This file detects the current enabled PHP version of wampserver (http://www.wampserver.com/) and executes the enabled php.exe and all parameters are passed
@REM Copy this file to WAMPSERVERPATH\bin\php
@REM Now you can add WAMPSERVERPATH\bin\php to your Windows Environment-Variable "PATH". Now you can use "php" global. For example "php -v".
@REM You can show the current PHP version with "php -v"
@setlocal enableextensions enabledelayedexpansion
@echo off
set serverPath="%~dp0\..\.."
set file="!serverPath!\wampmanager.conf"
set area=[php]
set key=phpVersion
FOR /F "tokens=*" %%a IN ('type %file%') DO (
set ln=%%a
if "x!ln:~0,1!"=="x[" (
set currarea=!ln!
) else (
for /f "tokens=1,2 delims== " %%b in ("!ln!") do (
set currkey=%%b
set currval=%%c
if "x!area!"=="x!currarea!" (
if "x!key!"=="x!currkey!" (
set !currkey!=!currval:"=!
)
)
)
)
)
CALL !serverPath:"=!\bin\php\php!%key%!\php.exe %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment