【问题标题】:Unable to launch a packaged executable as a Windows service via ProcRun无法通过 ProcRun 将打包的可执行文件作为 Windows 服务启动
【发布时间】:2019-07-17 13:39:47
【问题描述】:

我需要在 的帮助下以 的形式启动可执行文件。

我按照以下步骤操作。

  1. 创建了一个名为run.bat,用于创建服务。
"C:\Program Files (x86)\Test\prunsrv.exe"  //IS//Test --DisplayName="Test" --Startup=auto --Install="C:\Program Files (x86)\Test\prunsrv.exe"  --StartMode=exe --StartImage="C:\Program Files (x86)\Test\batchSample.exe"  --LogPath="C:\Program Files (x86)\Test\logs" --StdOutput=auto --StdError=auto
  1. 创建了batchSample.bat 来启动 URL:
start https://www.youtube.com/watch?v=q3pG6b3uI_E
  1. 转换为batchSample.exe,并将其放入C:\Program Files (x86)\Test
  2. 已执行run.bat

此时windows服务Test启动没有给出任何错误,但它没有像--StartImage那样执行batchSample.exe

感谢您的帮助。

【问题讨论】:

    标签: windows service procrun batch-file batch-file batch-file executable windows batch-file service executable procrun


    【解决方案1】:

    你的批处理文件不是可执行文件,无论你给它什么扩展名。

    根据文档 - https://commons.apache.org/proper/commons-daemon/procrun.html

    --StartImage 将运行的可执行文件。只适用于exe模式。

    ++StartParams 将传递给 StartImage 或 StartClass 的参数列表。使用 # 或 ; 分隔参数字符。

    您需要一个程序以 StartImage (sh?) 的形式执行批处理文件,并将批处理文件放入 StartParams。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-30
      • 2018-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多