1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Controlling Windows Services via Batch Script

Discussion in 'Windows' started by gpicazo, Nov 25, 2008.

  1. gpicazo

    gpicazo New Member

    Hi everyone,

    I am trying to write a batch script for the following deployment scenario:

    I have a list of services (about 10 of them) that run on a remote server (target for deployment). Before deploying any files to the server, I want to stop any of those 10 services if they are running. Then I can copy/override whatever files I need to for the deployment. Once the deployment is complete, I need to restart ONLY those services that were running prior to the deployment.

    I know to use the 'sc' command to stop and start the services, I just don't know how to keep track of which services need to be restarted.

    Any help would be greatly appreciated. A sample that depicts a possible solution would be even better.

    Thank you,
  2. pradeep

    pradeep Team Leader

Share This Page