Skip to content

ServerApplication: Windows SCM does not forward ImagePath arguments to ServiceMain #5236

@sreckovic1987

Description

@sreckovic1987

Description
When a ServerApplication is registered as a Windows Service with command-line
arguments in the ImagePath registry entry (e.g. "app.exe" --config-file "path\to\config.properties"),
those arguments are NOT forwarded to ServiceMain when the service is started
by the Windows SCM (Service Control Manager).

Reproduction

  1. Create a ServerApplication-based app with a --config-file option handler
  2. Register as Windows service with arguments in binPath:
    sc create MyService binPath= "\"C:\path\app.exe\" --config-file \"C:\path\config.properties\""
  3. Start the service via SCM (net start / Services MMC)
  4. Observe that --config-file argument is never processed — option callback is not invoked

Expected behavior
Arguments present in the ImagePath registry entry should be available in
ServiceMain just as they are when the application is launched from the command line.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions