Syntax
UPPERCASE words are placeholders to replace. Brackets in the syntax line describe optional arguments; do not type those brackets literally.
sc.exe query [SERVICE_NAME] [type= TYPE] [state= STATE]Example
sc.exe query W32Time
sc.exe query type= service state= allExpected result
Windows Time status, then service records including inactive services. Results depend on installed services and permissions; a running state is not a complete application-health test.
Notes and traps
Keep the space after type= and state=. Use the internal service name, which may differ from the display name. sc.exe is explicit so the command is not confused with a shell alias in Windows PowerShell. Query is read-only; other sc.exe subcommands can change or delete services.
Try it
Why might plain sc.exe query show fewer services than state= all? Compare its W32Time state with Get-Service on the same machine.
Answer and reasoning
The default enumeration selects active services; state= all includes inactive ones. Both interfaces ask about service state and should agree when observed at the same time, but they format results differently. Neither proves that the service's higher-level function succeeds.
Related commands
Related tasks may need different flags and have different semantics. Check the entry before translating a command between shells.
Official reference ↗Updated 14 September 2026. Microsoft reference reviewed 14 September 2026; CMD/Windows execution unavailable.