• sc queryThis command, by default, displays information about active services and drivers. 
     
  • sc query type=serviceThis command displays information about all services, including those that are not active. 
     
  • sc query state=allThis command displays information about all services, whether active or inactive. 
     
  • sc query <service_name>This command displays information about a specific service, where <service_name> is the name of the service you want to query. 
     
  • sc queryex type=service state=allThis command displays extended information about all services, including those that are not active. 
     
  • sc queryex type=driverThis command displays extended information about all drivers. 
     
  • sc qc <service_name>This command displays configuration information for a specific service. 
     
  • sc qdescription <service_name>This command displays the description string for a specific service. 
     
  • sc qfailure <service_name>This command displays the actions that will be performed if the specified service fails. 
     
 
Examples:
  • To display information about all services, including inactive ones: sc query state=all 
     
  • To display information about the “Wuauserv” service: sc query wuauserv 
     
  • To display extended information about all services: sc queryex type=service state=all 
     
  • To display configuration information for the “IIS Admin Service”: sc qc iisadmin 
     
  • To display the description of the “NewServ” service: sc qdescription newserv 
 
sc state= active¦inactive¦all

sc query | findstr SERVICE_NAME


sc query state= all | findstr "SERVICE_NAME STATE"


sc query state= all | findstr "DISPLAY_NAME STATE"
 
sc query state= all | findstr "SERVICE_NAME DISPLAY_NAME STATE"


for /f "tokens=2" %s in ('sc query state^= all ^| find "SERVICE_NAME"') do
    @(for /f "tokens=4" %t in ('sc query %s ^| find "STATE     "') do @echo %s is %t)



@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.Service                                                  State
ECHO.-------------------------------------------------------  -------------

FOR /F "TOKENS=2" %%S IN ('sc query state^= all ^| FIND "SERVICE_NAME" ^| FIND /I "myservice"') DO (
    @(FOR /f "TOKENS=4" %%T IN ('sc query %%S ^| FIND "STATE     "') DO (
        SET OUTPUT="%%S -------------------------------------------------------------"
        @ECHO !OUTPUT:~1,55!^> %%T
    ))
)
ENDLOCAL




sc query state= all | find "SERVICE_NAME"