sc.exe how to set up the description for the windows Service?
C#Windows ServicesC# Problem Overview
I am using sc.exe command to install C# windows service.
C:Windows\System32> sc.exe Create "TestService1" binPath= "C:\Program Files (x86)\Test\TestService1" DisplayName= "TestWindowsService1"
It created service. I was able to start the service. Many Instances I was able to create using sc.exe command
Looking at Services
Name | Description | Status | Start type | Log on As
Description section is blank, I would like to set the descriptionm, Any way to set up description for the service using sc.exe commmand?
C# Solutions
Solution 1 - C#
You need to call sc again to set the description. For example:
sc description TestService1 "This is the description of the service.."
For more information, see here.
Solution 2 - C#
Is not
sc description TestService1 "TestService1"
as per documentation: https://technet.microsoft.com/en-us/library/cc742069.aspx ?
Solution 3 - C#
For those experiencing "A positional parameter cannot be found that accepts argument" (PositionalParameterNotFound) error while trying to use the "sc description" command, replace sc with sc.exe. Apparently it fixes the problem, although the "sc create" command works as expected, without .exe