如何设置窗口服务的描述?

我使用 sc.exe 命令来安装 C # windows 服务。

C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1"

它创建了服务。我能够启动服务。我能够使用 sc.exe 命令创建许多实例

服务

名称 | 描述 | 状态 | 开始类型 | 登录

描述部分是空白的,我想设置描述,有什么方法可以设置描述为服务使用 sc.exe 命令?

46890 次浏览

不是

sc description TestService1 "TestService1"

根据文档: https://technet.microsoft.com/en-us/library/cc742069.aspx

您需要再次调用 sc 来设置描述。例如:

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

有关更多信息,请参见 给你

对于那些在尝试使用“ sc description”命令时遇到“找不到接受参数的位置参数”(position tionalParameter terNotfound)错误的用户,请将 sc 替换为 sc.exe。显然,它解决了这个问题,尽管“ sc create”命令可以按预期工作,但是没有。前任