How to install windows service using sc command




















For example: sc description TestService1 "This is the description of the service.. Improve this answer. Donal Donal I find it weird that it wouldn't be a parameter in the create command.

This works though, thanks. I'm hoping in the future MS beefs up the Worker Service template to allow these things to be set through code rather than command line. Ahmed Ashour 4, 10 10 gold badges 31 31 silver badges 47 47 bronze badges.

Alexey Nagoga Alexey Nagoga 1 1 silver badge 5 5 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back To install the service you must run the program using the parameter -install. For example like: MyService.

Method 3: A general method There is also a general method available. There is third method that can be used to install and uninstall a service. There is a program available in Windows with the filename SC. The program can also be used to start and stop a service, and much more.

The program is normally located in Windows system folder, so you don't need to specify a path to the program to run it; you only need to specify the filename. The line below shows how to install a service using SC. More information is available on this page at Microsoft's website. SC can be used to create a new service as well. Once installed, you can work with the new service as normal in the Services application:. Note that only executables explicitly written to interface with the Windows Service Control Manager should be installed this way.

While SC will happily accept a regular, non-service binary, you will receive the fatal Error when you attempt to start the service. Employ a service wrapper like AlwaysUp in that situation. Needless to say, please use this command with caution!. Once a service is deleted it cannot be easily re-instated.

Removing the wrong service can render your computer unusable! So whenever you need to work with a service via a batch file or from a DOS command prompt, look to SC for support. Hi, great article. I have a Question About use of sc config. I want to Change the user who runs the Service.

I tried already a lot but did not got it working. And be sure to grant the user account the Logon as a service right. Be sure to try that as well. Hi, I cannot get a service to start and stay on. It starts and stops immediately. It needs to run for my accounting program to work.



0コメント

  • 1000 / 1000