Windows Service Management from the Command Line: correct start type

servicewindows

Services can be disabled using msconfig, and then enabled at a later time.

I found that they can also be enabled or disabled using sc config commands, by setting the start option as disabled or one of boot,system,auto,etc.

How can I create a script or use the command line in a program to determine which start type to use when re-enabling a service?

Best Answer

What would you need to determine? Whether or not it's already set to the type you want to set it to?

It really doesn't matter what the current state is. If you are "re-enabling" a service by setting it's startup type to Automatic and it's already set to Automatic then no change will ocurr, so you really don't need to determine what it's current state is.