如何在不使用 Windows 服务的情况下从 DOS 启动 Apache

How to start Apache from DOS without using Windows Services

我在 Windows 计算机上分别安装了 Apache、PHP 和 Mysql,但我想知道如何在不使用 [=18 的情况下启动、停止和重新启动 Apache =] 服务但直接使用DOS。在 Linux 我是这样做的:

sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2

但是Windows,有没有办法从DOS启动?

伙计,Windows 大约 2 年前就停止包括 DOS,除非你是 运行ning Windows 98 或那个时代左右的东西,否则你将无法在 DOS 中做任何事情通过 Windows.

现在 Windows 中的 运行 命令你可以使用命令提示符或 PowerShell 来完成。

  • 以管理员身份打开命令提示符

    键入 'net start' 以查看 运行ning 服务列表,找到名称 对于 Apache 服务,例如“Apache2.4”

    要停止服务类型“net stop Apache2.4”

    置顶启动服务再次输入“net start Apache2.4”

另一种方法是在 Windows 上本地安装一个预构建堆栈,例如 XAMMP,它带有一个 GUI 控制台,您可以在其中 start/stop 服务,例如 Apache,MySQL.