Partilhar via


Sc qc

 

Applies To: Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows Server 2003 with SP2, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012, Windows Server 2003 with SP1, Windows 8

Queries the configuration information for a specified service.

For examples of how to use this command, see Examples.

Syntax

sc [<ServerName>] qc [<ServiceName>] [<BufferSize>]

Parameters

Parameter

Description

<ServerName>

Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter.

<ServiceName>

Specifies the service name returned by the getkeyname operation.

<BufferSize>

Specifies the size (in bytes) of the buffer. The default buffer size is 1,024 bytes.

/?

Displays help at the command prompt.

Remarks

  • The qc command displays the following information about a service: SERVICE_NAME (service's registry subkey name), TYPE, ERROR_CONTROL, BINARY_PATH_NAME, LOAD_ORDER_GROUP, TAG, DISPLAY_NAME, DEPENDENCIES, and SERVICE_START_NAME.

  • Administrators can use Sc commands to determine the binary name of any service and find out whether it shares a process with other services. They do this by typing the following at the command prompt (where ServiceName is an actual service name):

    sc qc ServiceName
    

    Sc can help match up services in the Services node of Microsoft Management Console (MMC) with processes in System Monitor. If the binary name is Services.exe, the service shares the Service Controller process.

    The Services.exe program starts all services. To conserve system resources, several Win32 services developed for Windows are written to share the Services.exe process. These services are not listed as separate processes in System Monitor or Task Manager. The same is true of Svchost.exe, a service host process that is shared by many operating services.

    There might not be a process for every Win32 service because third-party Win32 services can also be configured to share processes. You can use Sc to get configuration information about these services. If a service does not share its process with other services, however, there will be a process for it in System Monitor when the service is running.

  • Sc commands can be useful for developers of services because it provides more detailed and accurate information about services than does Services.exe, which is included with Windows. Services.exe can determine whether a service is running, stopped, or paused. Although these tools are adequate for a debugged application that is running smoothly, the information they provide about a service being developed can be misleading. For example, a service that is starting is shown as started whether it is actually running or not.

    Note that Sc implements calls to all Windows service control application programming interface (API) functions. Set the parameters to these functions by specifying them at the command prompt.

    Using Sc commands, you can query the service status and retrieve the values stored in the status structure fields. Services.exe cannot provide you with the complete status of a service, but Sc shows the exact state of the service, as well as the last checkpoint number and wait hint. You can use the checkpoint as a debugging tool because it indicates how far the initialization progressed before the program stopped responding. In addition, Sc enables you to specify the name of a remote computer so that you can call the service API functions or view the service status structures on a remote computer.

Examples

To query the configuration information for the NEWSRVICE service running on a remote computer called "MyServer," type:

sc qc \\myserver newsrvice

To query the configuration information for the RPCSS service on the local computer, type:

sc qc rpcss

Additional references

Command-Line Syntax Key