Hi I need to check a windows services exist or not using batch command. if it exists need to delete it.
Asked
Active
Viewed 2,592 times
0
-
http://stackoverflow.com/questions/76074/how-can-i-delete-a-service-in-windows – SomethingDark Feb 04 '16 at 10:18
-
@ SomethingDark hi how to check the service exists or not before deleting it? – selvakumar Feb 04 '16 at 10:33
-
As it says **in the answer I linked**, use `SC QUERY`. – SomethingDark Feb 04 '16 at 10:38
-
@ SomethingDark thanks, yes it return some string value. How can i handle it with if check? – selvakumar Feb 04 '16 at 10:43
1 Answers
0
Like this with Admin rights:
@echo off
sc query Name_of_the_service >nul && sc stop Name_of_the_service

SachaDee
- 9,245
- 3
- 23
- 33