C# sc.exe如何设置windows服务的说明?

C# sc.exe如何设置windows服务的说明?,c#,windows-services,C#,Windows Services,我正在使用sc.exe命令安装C#windows服务 C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1" 它创建了服务。我能够启动这项服务。我可以使用sc.exe命令创建许多实例 查看服务 名称|说明|状态|开始类型|以用户身份登录 Description部分为空,我想设

我正在使用sc.exe命令安装C#windows服务

C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1"
它创建了服务。我能够启动这项服务。我可以使用sc.exe命令创建许多实例

查看服务

名称|说明|状态|开始类型|以用户身份登录

Description部分为空,我想设置descriptionm,使用sc.exe commmand为服务设置Description的任何方法都不适用

sc description TestService1 "TestService1"

根据文档:?

您需要再次致电sc以设置说明。例如:

sc description TestService1 "This is the description of the service.."

有关更多信息,请参见。

创建服务后,调用“sc description[service name][description]”来设置描述。我觉得奇怪的是,它不会是create命令中的参数。不过这很有效,谢谢。我希望将来微软会加强Worker服务模板,允许通过代码而不是命令行来设置这些内容。