Batch file 卸载和重新安装apache/php及其他服务

Batch file 卸载和重新安装apache/php及其他服务,batch-file,windows-services,Batch File,Windows Services,我今天发布这篇文章是为了了解是否可以使用命令提示符从记忆棒安装卸载服务,如Apache 我将xampp用于我的windows灯组 问题1 原因是我经常往返于不同的地方。为了轻便旅行的目的;我的老板要求我使用公司管理的memorystick,它将用于使用预构建的批处理脚本安装/卸载Apache服务 我将有权使用我将居住的计算机上的高架特权。但是这些机器中的大多数可能没有我成功开发所需的要求 所以我想知道我的树中是否有一个包含exe/库的文件夹 问题2 我有这个批处理脚本。问题是,不管主要输入是

我今天发布这篇文章是为了了解是否可以使用命令提示符从记忆棒安装卸载服务,如Apache

我将xampp用于我的windows灯组


问题1

原因是我经常往返于不同的地方。为了轻便旅行的目的;我的老板要求我使用公司管理的memorystick,它将用于使用预构建的批处理脚本安装/卸载Apache服务

我将有权使用我将居住的计算机上的高架特权。但是这些机器中的大多数可能没有我成功开发所需的要求

所以我想知道我的树中是否有一个包含exe/库的文件夹


问题2

我有这个批处理脚本。问题是,不管主要输入是什么。它会自动转到
:安装
。。出什么事了

@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

解决方案。将memorystick指定给不常用的字母。Z:\例如。除非设置,否则不会使用它

您不需要命令提示符。您可以轻松地复制必要的文件夹/文件。。例如:

C:\xampp\apache

C:\xampp\php

转到你的记忆棒。在Apache目录中对必要的配置文件进行更改。在这种情况下,它将是:

Z:\apache\conf\httpd.conf

<Directory "Z:/WebScripts">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
将显示
C:\xampp\htdocs
的所有内容移动到记忆棒上的其他目录。例如假设您想使用目录WebScript

举个例子:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "Z:/WebScripts"
股票httpd.conf上的第191行

<Directory "Z:/WebScripts">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.

#
#选项指令的可能值为“无”、“全部”,
#或以下任何组合:
#索引包括以下符号链接符号链接所有者匹配执行CGI多视图
#
#请注意,“多视图”必须显式命名为*--“所有选项”
#不给你。
股票httpd.conf上的第221行

<Directory "Z:/WebScripts">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
在Z:\root中创建该目录。如果不存在,则从memorystick安装服务时会遇到错误

安装Apache服务 在apache目录(Z:\apache)中,您将找到
apache_installservice.bat
apache_installservice.bat
使用管理权限运行它们

将创建服务并通过位于以下位置的exe运行:Z:\Apache\bin\httpd.exe
它将收集您的所有配置文件并运行一个支持PHP的apache服务。

您将如何配置脚本的处理位置?