Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Use \sc qc\ to Query Windows Service Configuration via CMD

The "sc qc" command is a part of the Service Control (SC) command suite in Windows, which is used to interact with Windows services from the command line. Specifically, "sc qc" is used to query the configuration of a specified service. This can be useful for systems administrators and engineers who need to quickly gather information about how a service is set up, including details such as the service type, start type, error control, and the path to the executable.

Examples:

  1. Basic Usage of "sc qc":

    To query the configuration of a specific service, you can use the following command syntax:

    sc qc <ServiceName>

    Replace <ServiceName> with the actual name of the service you want to query. For example, to query the configuration of the Windows Update service, you would use:

    sc qc wuauserv

    This command will output information such as:

    • SERVICE_NAME: wuauserv
    • TYPE: 20 WIN32_SHARE_PROCESS
    • START_TYPE: 3 DEMAND_START
    • ERROR_CONTROL: 1 NORMAL
    • BINARY_PATH_NAME: C:\Windows\system32\svchost.exe -k netsvcs -p
    • LOAD_ORDER_GROUP:
    • TAG: 0
    • DISPLAY_NAME: Windows Update
    • DEPENDENCIES: rpcss
    • SERVICE_START_NAME: LocalSystem
  2. Using "sc qc" with Administrative Privileges:

    Some services may require administrative privileges to view their configuration. To ensure you have the necessary permissions, open the Command Prompt as an administrator:

    • Click on the Start menu.
    • Type "cmd" in the search bar.
    • Right-click on "Command Prompt" and select "Run as administrator."

    Once the elevated Command Prompt is open, you can execute the "sc qc" command as shown above.

  3. Automating Service Configuration Queries:

    If you need to query multiple services, you can automate the process using a batch script. Here is an example script that queries the configuration of several services and outputs the results to a text file:

    @echo off
    set outputFile=ServiceConfig.txt
    echo Service Configuration Report > %outputFile%
    echo ============================= >> %outputFile%
    
    for %%S in (wuauserv, bits, spooler) do (
       echo Querying %%S... >> %outputFile%
       sc qc %%S >> %outputFile%
       echo ----------------------------- >> %outputFile%
    )
    
    echo Report generated in %outputFile%

    Save this script as "QueryServices.bat" and run it from an elevated Command Prompt. The results will be saved in "ServiceConfig.txt".

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.