You can edit the wmic
and filter the Service Name instead of the path.
Wmic service where (Name like '%sql%') get caption, name, startmode, state, PathName, ProcessId
or in PowerShell (I'd suggest you to use this approach)
Get-Service *sql*
this will return all Services that have SQL in their name.
you can also use this from cmd like so: powershell "Get-Service *sql*"
Example Output:
PS C:\Windows\system32> get-service *sql*
Status Name DisplayName
------ ---- -----------
Running MSOLAP$SDFSF SQL Server Analysis Services (XXXXX...
Running MSSQL$SDFSDFS SQL Server (XXXXXXXXXX)
Running MSSQL$SDFSDF SQL Server (XXXXX)
Running MSSQLFDLauncher... SQL Full-text Filter Daemon Launche...
Running MSSQLLaunchpad$... SQL Server Launchpad (XXXX)
Running ReportServer$BB... SQL Server Reporting Services (XXXX...
Stopped SQL Server Dist... SQL Server Distributed Replay Client
Stopped SQL Server Dist... SQL Server Distributed Replay Contr...
Stopped SQLAgent$xxxxxx... SQL Server-Agent (xxxx1)
Stopped SQLAgent$xxxxx SQL Server Agent (xxxxx)
Running SQLBrowser SQL Server Browser
Running SQLTELEMETRY$BB... SQL Server CEIP service (xxxx)
Running SQLTELEMETRY$xxxxx SQL Server CEIP service (xxxxx)
Running SQLWriter SQL Server VSS Writer
Running SSASTELEMETRY$B... SQL Server Analysis Services CEIP (...
bin
directory instead ofbinn
. (And this is why relying on a path is iffy. Microsoft, in future versions, is much more likely to change where an executable is installed than they are to change the name of the service.)