Skip to content

Instantly share code, notes, and snippets.

Created December 4, 2015 23:25
What would you like to do?
Dynamic PHP executabe for wampserver depend on current enabled version. [tested on Windows10 with Wampserver3_x86]
@REM This file detects the current enabled PHP version of wampserver ( 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