I’m posting today to find out whether it is possible to install-uninstall services such as Apache from a memory stick using command prompt.
I am using xampp for my LAMP Stack for windows.
Question 1
The reason for this, is that I travel frequently to and from various different locations. for the purpose of traveling light; my boss has requested that I take a company regulated memorystick which will be used to install/uninstall the Apache services using a pre-built batch script.
I will have access to the elevated prividgles on the computers I will be staying at. but a majority of these machines might not have the needed requirements for me to sucessfully develop.
So I was wondering if just having a folder in my tree with the exe/libraries?
Question 2
I have this batch script. The problem is, that regardless of the primary input. it automatically goes to :Install.. What is going wrong?
@ECHO OFF
@ECHO Service Management
@echo Please Select an Option
@echo 1) Install Apache and other set services
@echo 2) Uninstall Services
SET /p option = Please Select:
IF "%option%" == "1" GOTO Install
IF "%option%" == "2" GOTO Uninstall
IF "%option%" gtr "2" GOTO Error
:Install
SET /p path=Enter Path Of MemoryStick (letter only):
@echo Install
PAUSE
EXIT
:Uninstall
SET /p path=Enter Path Of MemoryStick (letter only):
@echo Uninstall
PAUSE
EXIT
:Error
@echo Error. Please Re-run
PAUSE
EXIT
Solution. Assign your memorystick to a letter which is not usually used. Z:\ for example. Nothing will use it, unless set.
You do not need your Command prompt. You can easily copy over the necessary folders/files.. For example:
over to your memory stick. Make the changes to the necessary configuration files within the Apache directory. In this case it would be:
Move everything which says
C:\xampp\htdocsto a different directory on your memory stick. For example. Say if you wanted to use the directory WebScriptsTake this example:
Line 191 on a stock httpd.conf
Line 221 on a stock httpd.conf
Create that directory within your Z:\ root. If this does not exist then you will encounter errors with installing the service from your memorystick.
Installing Apache Services
in your apache directory (Z:\Apache) you will find
apache_installservice.batandapache_uninstallservice.batrun these with administration rights.The services will be created and will run through the exe located at: Z:\Apache\bin\httpd.exe
which will gather all your configuration files and run an apache service with PHP Support.