How to check if a service is running via batch file and start it, if it is not running?

后端 未结 14 1566
暖寄归人
暖寄归人 2020-11-30 18:15

I want to write a batch file that performs the following operations:

  • Check if a service is running
    • If is it running, quit the batch
    • If
14条回答
  •  無奈伤痛
    2020-11-30 18:29

    I just found this thread and wanted to add to the discussion if the person doesn't want to use a batch file to restart services. In Windows there is an option if you go to Services, service properties, then recovery. Here you can set parameters for the service. Like to restart the service if the service stops. Also, you can even have a second fail attempt do something different as in restart the computer.

提交回复
热议问题