我正在使用 sc.exe 命令安装 C# Windows 服务。
C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1"
它创造了服务。我能够启动该服务。我能够使用 sc.exe 命令创建许多实例
查看服务
姓名 | 描述 |状态 |启动类型 |登录身份
描述部分为空,我想设置描述,有什么方法可以使用 sc.exe 命令设置服务描述吗?
需要再次调用sc来设置描述。例如:
sc description TestService1 "This is the description of the service.."
欲了解更多信息,请参阅此处。
不是
sc description TestService1 "TestService1"
根据文档:https://technet.microsoft.com/en-us/library/cc742069.aspx?
对于那些在尝试使用“sc description”命令时遇到“无法找到接受参数的位置参数”(PositionalParameterNotFound) 错误的用户,请将 sc 替换为 sc.exe。显然它解决了问题,尽管“sc create”命令按预期工作,没有 .exe
此命令在“sc create service_name...”之后调用下一个命令: sc description service_name “服务描述”