相关疑难解决方法(0)

如何从命令行指定名称和描述安装Windows服务?

我用Delphi为客户端服务器应用程序创建了一个Windows服务.

要安装它,我使用

c:\Test\MyService.exe /install (or /uninstall)
Run Code Online (Sandbox Code Playgroud)

这将安装该服务,并在Windows服务中列出"MyService"名称和空描述.

如何定义不同的名称并插入描述(在运行时可以看到services.msc)?

注意:我需要这个,因为在同一台机器上我需要安装更多次相同的服务(每个数据库1个).

目前我唯一的解决方法是重命名服务exe,但我更愿意找到正确的命令行方式(因为我这样做ShellExecute).

更新:不知怎的,我会寻找类似的东西(这当然只是出于解释原因! - InstallService.exe是我刚刚发明的名字):

InstallService.exe c:\Test\MyService.exe /install /name='MyService1' 
  /description='This is my service for database 1'
Run Code Online (Sandbox Code Playgroud)

而且更紧凑的版本会很好:

c:\Test\MyService.exe /install /name='MyService1' 
  /description='This is my service for database 1'
Run Code Online (Sandbox Code Playgroud)

windows-services shellexecute

12
推荐指数
1
解决办法
3万
查看次数

标签 统计

shellexecute ×1

windows-services ×1