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

前端 未结 8 2116
南旧
南旧 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:38

    Powershell can do this but you have to use .Net to achieve it.

    new-Object System.ServiceProcess.ServiceController("$ServiceName",$ComputerName)).Start("$Parameter")
    

提交回复
热议问题