Batch Script to restart service

7,278

If you go to the services, and open Windows Firewall for example. You can see the service name, mpssvc. The way you would set the service to restart is by putting this in the batch file.

net stop mpssvc
net start mpssvc

You would want to save that to a shared location then add it to the scheduled tasks to run at the time you would like.

Share:
7,278

Related videos on Youtube

Hemant Sankhla
Author by

Hemant Sankhla

Updated on September 17, 2022

Comments

  • Hemant Sankhla
    Hemant Sankhla over 1 year

    Can anyone help with a peice of batch script to restart an application service at scheduled time.

    For example: If the service is "windows firewall " Then the script should restart this service every day at 09:00 AM and 09:00PM . Can someone help with complete code.(Assume that there is no dependency of this service on any other service).Any help is greately appreciated.

    Thanks Harry

  • Overmind
    Overmind about 4 years
    @Nixphoe your code can be combined in one line using "&&".