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

Chandan Kumar picture Chandan Kumar · Dec 14, 2012 · Viewed 203k times · Source

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.

Answer

Chandan Kumar picture Chandan Kumar · Dec 28, 2012
sc queryex type= service state= all | find /i "NATION"
  • use /i for case insensitive search
  • the white space after type=is deliberate and required