How to pass a parameter to a windows service once and for all at install instead of each start

前端 未结 8 2109
南旧
南旧 2020-12-09 04:13

We have a Windows Service application that can accept command line parameters like:

MyService -option 

So far, when we want to start the

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-09 04:42

    If there is more than one service with the same executable then you would be installing them with different service names. You could refer to the service name instead of the parameters.

    To get the service name you can use this How can a Windows Service determine its ServiceName?

提交回复
热议问题