How to know process PID of the service via the console?

Open the task Manager in the services tab, you can choose the service, and to see her process. And how to find it through the console? For example I need to kill the process of the particular service.
July 9th 19 at 13:56
3 answers
July 9th 19 at 13:58
PowerShell to use.
Get-Process | where {$ -match "123"} | Stop-Process

Get-Process - lists the current processes.
| conveyor
$ _ is transferred by conveyer value
.id - the parameter values
where - condition 
Stop-Process - stop the process
July 9th 19 at 14:00
so (for printing service):
$ServicePID = (get-wmiobject win32_service | where { $ 'spooler'}).processID
Stop-Process $ServicePID -Force

or semi manual (can also be finished):
sc queryex spooler
taskkill /f /pid 123123123
July 9th 19 at 14:02
Using the sc utility, you can perform any manipulation with the services, including to start, stop, etc.
sc stop <the name of the service>

Find more questions by tags Terminalcmd/batWindows