【问题标题】:Start Apache in background with batch file使用批处理文件在后台启动 Apache
【发布时间】:2013-03-24 23:35:59
【问题描述】:

我正在编写一个将启动 Apache 的批处理文件,并在 Web 浏览器中打开 http://localhost。最简单的形式:

@start apache\bin\httpd.exe
@start http://localhost

这会导致批处理文件运行 Apache、打开网页并退出。但是,httpd.exe 在它自己的终端窗口中打开,而不是在后台隐藏打开。如何让它在没有可见窗口的情况下打开?

【问题讨论】:

    标签: windows apache batch-file


    【解决方案1】:

    试试这个:

    @start /b "" apache\bin\httpd.exe
    

    【讨论】:

    • 谢谢!我确信这是我需要传递给 httpd.exe 的设置 - 我没想到看到 start 可以提供什么
    • 这很奇怪......使用这个,Apache 窗口被隐藏,但空白的 cmd 窗口保持打开状态。你知道如何解决这个问题吗?
    • 尝试在脚本的最后一行设置exit
    【解决方案2】:

    在另一个网站上看到这个。它可能会起作用。

    在后台启动它:

    command &
    

    然后运行:

    disown
    

    然后关闭终端。

    您可以使用 Ctrl+z 停止前台应用程序,然后使用 bg (fg) 命令在后台(前台)启动它。

    【讨论】:

      猜你喜欢
      • 2010-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-08
      • 2017-08-13
      • 2021-07-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多