I have an own windows service. I want to get the PID of the service and then kill it in the cmd.
Which command could do this for me?
I have an own windows service. I want to get the PID of the service and then kill it in the cmd.
Which command could do this for me?
You could use tasklist
to enumerate the processes:
@echo off
for /f "tokens=2" %%p in ('tasklist /fi "imagename eq your_svc.exe" /nh') do (
set PID=%%p
)
and then kill the process via taskkill
:
taskkill /pid %PID%