1
votes

I'm using XAMPP on my USB flash drive - which makes it easy for me to take my dev. environment with me from one PC to another.

However, I want to be able to serve files for my projects directly from my /Projects folder - which is in the root of the drive - instead of having to copy this folder into /htdocs.

I've read on the web that I can easily do this by adding an alias to 'httpd.conf' - but I would then need to hard-code the drive letter - which can be different for every PC I plug my USB into.

Is there any way to add a dynamic driver letter to my alias ?

Or - can I maybe use a relative path somehow ?

Or - am I going about it wrong and there's a better way to do it ?

Thanks in adv!

1

1 Answers

0
votes

First of all, I think you already know that xampp lite supports relative addressing to run it in portable mod.

But when it comes to location of htdocs folder, I didnt experienced something like that. But I can offer some alternates (without moving the htdocs folder) which can be useful.

This simple .bat file (located in the same root of xampp folder)

@ECHO OFF
:START
Start xampp\htdocs

Can open your "htdocs" folder without depending to drive letter. If you try to make something more complicated, here it comes the drive letter variable in .bat

@ECHO OFF
PUSHD \
SET AMOVIBLE=%CD%
POPD
ECHO %AMOVIBLE%
PAUSE

This example will show you the drive letter that the bat file executed from. Just move the %AMOVIBLE% variable wherever you want in your code.

And if variables from an external file is needed

Define variable
(SET /P var=)<sometextfile.txt
MKDIR folder\%var%\folder\

This can help. So, if the movement of htdocs folder is not obligated, I think these will help. If not, sorry out of my range :)

Regards