batch file to start /stop a service

September 28, 2011 at 01:58:49
Specs: Windows 7
i need help to write a batch file that stop and start a windows service and if he didnt file the service then he will go to an another service

See More: batch file to start /stop a service

Report •


#1
September 28, 2011 at 15:21:01
Open a command prompt and type in:
net start /help
and
sc /?

Or,
Google for the commands "net start" and "sc".

You are expecting our help, we are expecting your response !!!


Report •

#2
September 29, 2011 at 02:49:05
htnx for the fast answer

but i dont know if SC fits here

this is what i mean
net stop @service@
sleep 20
net start @service@
but how to continue, if the serivce doesnt Exists


Report •

#3
September 29, 2011 at 08:15:10
Use the %errorlevel% to check, whether the service is successfully started or stopped.
On success, errorlevel is 0, if service does not exist, errorlevel is 2.

You are expecting our help, we are expecting your response !!!


Report •

Related Solutions

#4
January 6, 2012 at 09:25:13
SET /p kupa=
psexec \\%kupa% cmd /c "net start aipctrld"
sleep 30
If %ERRORLEVEL%= 0 goto :end
If %ERRORLEVEL%= 2 goto :start

:start
cmd /c "net start AIPStart"


:end
pause
exit /b


it still doesnt work


Report •


Ask Question