views:

201

answers:

1

It is save to terminate the services using taskkill when the attempt to stop using NET STOP was failed? And if i terminate it using taskkill, do NET START command will affect or do i need to use START command?

consider this code as example:


@ECHO OFF
:STOP
NET STOP someservices
IF ERRORLEVEL == 0 GOTO :START
GOTO :KILL

:START
NET START someservices

:KILL
TASKKILL /F /IM someservices.exe
SLEEP 10
START someservices.exe 
+1  A: 

Use SC instead of NET -- it won't fail.

Billy3

EDIT: And you will have difficulty killing a fair number of services which can share the same process. EDIT2: See this for more details -> http://support.microsoft.com/kb/314056

Billy ONeal
"And you will have difficulty killing a fair number of services which can share the same process" which one? SC or NET?
Dels
Either. Many windows services share the same svchost.exe process.
Billy ONeal