Search code examples
command-linewindows-servicescommandcommand-prompt

How to get all Windows service names starting with a common word?


There are some windows services hosted whose display name starts with a common name (here NATION). For example:

  • NATION-CITY
  • NATION-STATE
  • NATION-Village

Is there some command to get all the services like 'NATION-'. Finally I need to stop, start and restart such services using the command promt.


Solution

  • sc queryex type= service state= all | find /i "NATION"
    
    • use /i for case insensitive search
    • the white space after type=is deliberate and required