Sc.exe: Service Controller Tool Topics | Previous

How Developers Can Use SC


SC can be useful for developers of services, because it provides more detailed and accurate information about services than the two end-user tools provided with Windows 2000. The Services Control Panel and the network command-line interface, Net.exe, can determine whether a service is running, stopped, or paused. Although these tools are fine for completely debugged applications when everything is running smoothly, the information they provide about a service being developed can be misleading.

SC implements calls to all of the Windows 2000 service control application programming interface (API) functions. You can set the parameters to these functions by specifying them at the command prompt.

With SC, you can query the service status and retrieve the values stored in the status structure fields. Net.exe and the Services Control Panel cannot provide you with the complete status of a service, but SC will tell you the exact state of the service, as well as show the last checkpoint number and wait hint. The checkpoint can then be used as a debugging tool, because it provides a clear indication of how far the initialization progressed before the program froze. The tool also lets you specify the name of a remote computer so that you can call the service API functions or view the service status structures on the remote computer.