Reputation: 4719
I have a windows service named 'shipper' running which processes files.
In task manager, the Services tab shows the following
name:shipper
PID: 5000
status:running
In the Process tab:
image name: java.exe
user: SYSTEM
When I execute the following:
taskkill /f /PID 5000
task manager (Services tab) shows that the service is stopped. However, it continues to execute and process files.
Only when I end the process in task manager will the process stop. Similarly, this will work:
taskkill /f /im "java.exe"
But of course, that kills all java processes.
What is the correct way, using taskkill
(or another standard windows command) to kill the process using the name of the service ("shipper" in this case)?
Thanks
Upvotes: 1
Views: 2513
Reputation: 26120
Find the processID used by your service:
for /f "tokens=2 delims=:" %%i in ('sc queryex "shipper" ^|findstr PID') do echo %%i
or try a filter TASKKILL /F /FI "services eq shipper"
in addition you may use the following parameter of taskkill:
/T
Tree kill: terminates the specified process and any child processes which were started by it.
Upvotes: 1