How Stop And Start Windows Services From A Batch File

4

winlogo.jpgOne of the several things I like to do to keep my Windows computer running efficiently as possible is to remove unnecessary programs or processes from running that I really don't need (such as crapware).

The next type of optimization I usually perform is to see if there are processes that I do need, but don't want them running all the time and wasting valuable resources that can slow down performance. The first place I usually look for these types of processes is Windows Services that are set to auto start during boot up.

Once I identify which service or set of services I don't need running constantly in the background, I'll create a simple batch file that can be clicked on to start them up quickly…when I need to have them running.

If you are not familiar where to look for Windows services, there are several ways to access the services console window. The quickest way is to click on Start \ Run and enter services.msc from the run box.

Another way is to right click on My Computer icon on your desktop, and select Manage from the context menu. When the Computer Management window opens, expand Services and Applications and click on the Services icon.

You will see all the services listed and if they have been auto started by looking at the Status column. If you can not identify a particular service, just click on it and it's description will be displayed in the left column (as shown in the below screen shot for the browser service).

NOTE: Do not randomly change the startup settings for a service. Make sure you understand what the service is and if it will effect Windows from running properly by having it not auto start during boot up. An excellent source for reference is BlackViper.com which lists all services for Windows XP and Vista.

To create the batch file for starting services, you will need to identify the services or services. On my system I have VMWare Server installed. This is a program that allows me to run virtual machines (such as Windows and Linux) on my computer with out needing a separate PC, but I don't need it running every time I use my computer.

From the screen shot below, you can see all VMware services from the console.

First I want to make sure to set each service Startup Type is set to Manual and stop the service, by right clicking on each service and select Properties.

Next create a text file on your desktop (right click on an empty space, then select New \ Text Document ) and give it a name. In my example I have named the file startvmware.bat .

Now right click on the file and select edit to open the file (do not double click on it).

Using the names of each service in the first column (shown in above screen shot) I can create the batch file as shown below:

ECHO Starting VMWare Services
net start "VMware Authorization Service"
net start "VMware DHCP Service"
net start "VMware NAT Service"
net start "VMware Registration Service"
net start "VMware Virtual Mount Manager Extended"
exit

The ECHO command is used display (echo) the text in the command window. The net start command is used to start the services. Also if the service has spaces in it's name, it must be enclosed in double quotes.

Once you have entered the text, save and close the file. When you want to start up the program, all you need to do is double click on the batch file and it will run.

To create a batch file for stopping services, just follow the same steps above (for creating a batch file), and use the net stop command to stop the services.

ECHO Stopping VMWare Services
net stop "VMware Authorization Service"
net
stop "VMware DHCP Service"
net
stop "VMware NAT Service"
net
stop "VMware Registration Service"
net
stop "VMware Virtual Mount Manager Extended"
exit

When you want to stop the services, just double click on the batch file you have created and the services will stop.

That's it. Now you have batch file that can stop and start services…when you want them to run or not.

Comments on How Stop And Start Windows Services From A Batch File Leave a Comment

April 21, 2010

zach @ 2:20 pm #

this is a great tutorial i am looking on how to do something similar to this and was going to see if you knew how to do it. i want to create a batch file that sets a list of services to manual instead of auto. with these services set to manual it makes my system a lot faster. i fix peoples computers and i want to create this file to make things easier and faster for me to do so. any help would be appreciated thanks

December 5, 2010

stimart @ 6:07 pm #

Hi! Thanks about this guide!
I've a question for you and I hope u can help me: I really need to start "vmware player" services and process only when I run vmware player software and also stop it when close!
So, is there any way to do that with an automatic process that start and stop batch files when run vmware player?
Thanks

December 3, 2020

Hossain Mohammad Imran @ 9:14 am #

Thanks for any other informative website. Where else may I get that kind of information written in such a perfect way?
I've a undertaking that I am just now running on, and I have been on the look out for
such information.

June 8, 2021

@stimart: I created a batch file that toggles the VMware services. when they start it also starts VMware and then I run it again when I'm done. The other way is to see if the program is running and stop them when it isn't but that will timeslice your computer.

Leave a Comment

Fields marked by an asterisk (*) are required.

Subscribe without commenting