C
C
csergey2014-04-30 08:58:48
cmd/bat
csergey, 2014-04-30 08:58:48

How to pause script or make sleep in bat file?

It is necessary to write a script that will restart the windows service
. One problem, the service stops for about 5 seconds.
Tell me a command like sleep to be inserted between the stop / start commands
sc stop service
................
sc start service

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Somov, 2014-04-30
@jsom

ping -n %Timer% 127.0.0.1>nul

C
csergey, 2014-04-30
@csergey

and if anyone can, write this script in a loop (meaning the service stops, if the service is stopped, then another command is executed, if not, then wait a second) (I think that in this case it is not appropriate, I'm just wondering)

V
v_prom, 2014-04-30
@v_prom


On Windows Vista / Windows 7 you can use the timeout command:
timeout /T [delay in seconds] /NOBREAK > NUL
stackoverflow
but in general there seems to be a restart for services.

K
Konstantin, 2014-04-30
@fallen8rwtf

analogue of sleep - timeout [sec]
the problem is not solved? what kind of service is so "good"?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question