I am aware that under windows 7 the command-line commands...

  • tasklist gets me processes (including services) currently running by it's executable name
  • net start shows me all the display names of started services. (“pretty” display names, not the shorter, space-less service names)

What I would like to achieve on the command line is

  • from executable name (wmiserv.exe) to the service name behind
  • vice versa (o.k., this way round could also be done in the services.msc panel, looking up the services properties)

If there was a command that, say, lists it all ( executable(+incl. path maybe), service name, display name) and I can grep my to the lines I need, that would be perfect.

I lack understanding, if separate rules for svchost-Services apply.

Example: I am currently try to find the service behind C:\Windows\System32\wmiserv.exe, which locks some files. Googling for such only gets one a wild bunch of search spam and dodgy „Download FixingTool.exe“. All I can find in the exe's Properties Dialog (assuming that it is benigm in the first plane) doesn't sound like any service name I can come up with.


I didn't find a single commando, but was able to do make a batch file for you.

Save the following code in a file 'GetServide.cmd' and run it from the command line.

To search for wmiservice.exe, the syntax would be something like: GetServide.cmd wmiservice.exe

@echo off

REM Syntax: GetService.cmd [keyword]

REM --- Get Keyword ---
Set Keyword=%1

REM --- Get all services ---
for /f "tokens=2" %%a in ('sc query^|find /i "SERVICE_NAME"') do Call :DoSearch %%a
Goto :EOF

REM --- Search Function ---
  REM --- Set service name, quit if empty ---
  Set FoundOutput=
  Set SrvName=
  Set srv=%1
  if "%srv%"=="" goto :eof

  REM --- Serach keyword in services ---
  for /f %%a in ('sc qc "%1"^|find /i "%keyword%"') do set FoundOutput=%%a

  REM --- If keyword found, display info ---
  if "%FoundOutput%"=="" goto :eof
  ECHO Service: %srv%
  sc qc "%1"|find /i "BINARY_PATH_NAME"
  sc qc "%1"|find /i "DISPLAY_NAME"
  • Sweet. I would have thought, there might be a direct command ( a bit like dir /X /N listing short and full ), but well, this does work. Thank you! – Frank Nocke Sep 10 '15 at 7:28
  • I was also suprised that no such thing was build into sc.exe. – ZEDA-NL Sep 10 '15 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.