M
M
Mors Clamor2021-02-19 16:16:52
cmd/bat
Mors Clamor, 2021-02-19 16:16:52

Is NET STOP waiting for the service to terminate?

Hello! There is a task that restarts the service every night using a bat-nickname. bat file looks like net stop and net start one after the other. However, in the morning it turns out that the service does not always start. Could it be due to the fact that it does not have time to stop at the time start is executed and therefore the start command is ignored?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2021-02-19
@66demon666

It seems to be waiting.
But if the service is not terminated for any reason, then I do not know what behavior. Perhaps falls off on a timeout with some message. Redirect stdout and stderr output to a file so it can be parsed later.
In general, there is a more advanced command for working with services: sc /?
You can stop the service, check the status, and if it is stopped, then start it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question