But there are limits to what SC will do. This means that:. Indeed, as an MP3 is not a valid application, it is no surprise that attempting to start the service results in failure:.
So, as we have shown, SC is firmly focused on basic installation — not operation. The fact that a service was created with SC does not mean that the service can ever start or run. Even though SC will install any program as a service, the reality is that only specially constructed executables can actually operate as a service. We call those Service Applications. Service applications implement the Windows Services API — a set of operations used to control and monitor services.
They are not Service Applications. There is simply no way for Windows to directly control or interrogate any of those desktop programs as a service. The company produces Dropbox. But when you try to start the Dropbox Service from the Services application, a curious scenario plays out:.
Here you can see Dropbox and its two helper processes running in Process Explorer :. The options include: own - Specifies a service that runs in its own process. It doesn't share an executable file with other services. This is the default value. It shares an executable file with other services. Interactive services must be run under the LocalSystem account. Specifies the start type for the service. The options include: boot - Specifies a device driver that is loaded by the boot loader.
To start a disabled service, change the start type to some other value. Specifies the severity of the error if the service fails to start when the computer is started. The options include: normal - Specifies that the error is logged and a message box is displayed, informing the user that a service has failed to start.
Startup will continue. This is the default setting. The computer attempts to restart with the last-known good configuration.
This could result in the computer being able to restart, but the service may still be unable to run. If the last-known good configuration fails, startup also fails, and the boot process halts with a Stop error.
Worst thing, you could directly edit the Registry value afterwards if SC. EXE can't do it. I gave up on sc. I used Installutil. Add a comment. Active Oldest Votes. Improve this answer. Rohit Gupta 2, 11 11 gold badges 21 21 silver badges 36 36 bronze badges. Mhmd Mhmd 4, 3 3 gold badges 19 19 silver badges 29 29 bronze badges. Very good in case the end user is not an expert — LaBracca. Show 4 more comments. Parameters for created services have some peculiar formating issues, in particular if the command includes spaces or quotes: If you want to enter command line parameters for the service, you have to enclose the whole command line in quotes.
HugoRune HugoRune The command line interpreter must be expecting this and requiring the command to become tokenized by using space as the delimiter. I tried this way and it worked. This should be in the MS docs on sc. Community Bot 1 1 1 silver badge. Craig Carpenter Craig Carpenter 51 1 1 silver badge 2 2 bronze badges. Andrew Barber Tony Tony 49 1 1 silver badge 1 1 bronze badge. Panciz Panciz 2, 2 2 gold badges 27 27 silver badges 51 51 bronze badges. You can also get your arg1 and arg2 from args parameter on Main method.
LaBracca 14k 35 35 gold badges silver badges bronze badges. A service creation example of using backslashes with many double quotes. Nash A Nash A 67 4 4 bronze badges. I found a way to use sc. Rem Onyshczak Rem Onyshczak 11 1 1 bronze badge.
0コメント