Create Batch File to Start or End Window Services
Posted by David Kirk in Batch file programming
The windows environment can be easily changed by starting or ending various windows services. For example, this method can be used to easily shut down multiple services for a performance boost during game playing.
Update: This article was original crafted for XP; however, I continue to use this technique on my Windows 7 and Windows 8 systems. On more recent Windows systems, the batch file will need to be run as administrator.
Warning: Manipulating windows services can have unpredictable effects on your system. You should create a system restore point before experimenting.
We all want to tweak or windows systems to the extreme to get the quickest, most powerful system possible. Many people will disable multiple window services manually before game playing. What a pain!
Many times people forget what the services do or forget to restart the important ones. Services can be easily changed by creating batch files.
The important commands are the following:
NET START – starts the service
NET STOP – ends the service
For example:
NET STOP "Error Reporting Service"
Output: The Error Reporting Service service was stopped successfully.
Knowing the commands, one can now easily create batch files called something like beforegame.bat and aftergame.bat.
Before.bat would contain all the NET STOP commands to end the nonessential services.
After.bat would be exactly the same except all the NET STOP commands would be replaced with NET START commands to restart all the common services.
A sample of the before.bat file might look something like this:
NET STOP "Error Reporting Service"
NET STOP "FTP Publishing Service"
SET STOP "IIS Admin"
NET STOP "Messenger"
Likewise, the after.bat file might look something like this:
NET START "Error Reporting Service"
NET START "FTP Publishing Service"
SET START "IIS Admin"
NET START "Messenger"
You may wish to reference this: list of services that can be disabled.
If your system ever becomes unstable and you want to return the services to their default settings, the default settings for the windows services can be found here.
About David Kirk
View more articles by David Kirk
The Conversation
Follow the reactions below and share your own thoughts.


December 01, 2008 at 11:41 am, savita said:
Hi,
I am using net start to start a service. but my service name has sqaure brackets soemthign like abc[32.0] and becuase of square braces its failing. does anyone know escapae sequence for this?
many thanks
savita.
May 26, 2010 at 8:06 am, ilaya said:
can u help me bellow issue
check the particular service running or not in all 100 servers.we need to check this using single server.
March 06, 2009 at 1:09 pm, ramr said:
Would be nice to clearly add where those files should be located.
Thks, Regards
March 07, 2009 at 5:57 pm, leighw said:
Does anyone know how to DISABLE a service (not just stop it) so that it wont start again on the next reboot? I have tried the following: -
NET STOP “Service Name” (The service stops after a second or two)
SC Config “Service Name” start= disabled
But this error is produced on the second line: -
[SC] OpenService FAILED 1060: The specified service does not exist as an installed service.
Patently the service does exist as it was stopped successfully in the first line.
Thanks, Leigh
March 30, 2009 at 8:49 am, mrxbubbles said:
try double quotes on the second one around the service name
April 21, 2009 at 3:06 pm, Ravi said:
Thanks, But how to Enable / Disable Windows Services using DOS.
If the service is disabled, we cannot start the service using ” net start command ”
October 16, 2009 at 11:30 am, Anonymous said:
Nice one, I think it could help me cos am having a work station with oracle, SAP and microsoft SQL Server
October 21, 2009 at 10:26 am, Anonymous said:
Ya Finger Crossed,
i Was looking for Same.
Thanks,
Ahmad
November 18, 2009 at 9:03 am, Anonymous said:
I created batch file having this entry NET STOP “MSSQLSERVER” and it is prompting me to accept Y before execution.
How can I correct this to make auto-execute?
November 25, 2009 at 9:13 pm, Swati Gudla said:
Hello Everyone,
I am very new to windows services.
My question is..
Is there any DOS command to figure out the running services.
To be specific i have a windows service like “my service” i need to check the service is running or not..Is there any command to execute and see the running services…
I would really appreciate if some one can help me out to ….
December 23, 2009 at 1:55 am, Anonymous said:
sc query “my service”
and
net start
May 26, 2010 at 8:21 am, ilaya said:
hi sir,
please find the below sceneraio and help me to fix this, request you to provide bat and script file for this.
unix,windows
We have more than 100 servers in our environment, each server we have seperate user account. Need to change the password for all 100 servers from one server.
windows
check the particular service running or not in all 100 servers.we need to check this using single server.
May 26, 2010 at 8:07 am, ilaya said:
can u help me bellow issue
check the particular service running or not in all 100 servers.we need to check this using single server.
May 26, 2010 at 8:05 am, ilaya said:
check the particular service running or not in all 100 servers.we need to check this using single server using bat file
June 03, 2010 at 5:15 am, Mazz said:
Wickidellic!
August 30, 2010 at 8:19 pm, Fuzoukwu said:
To list all running services in Win XP issue the following command at the prompt:
C>tasklist
Have not tried it on Vista but it is likely to work also
September 25, 2010 at 5:25 pm, Mulani salim said:
we can create and delete same file again and again after 2 minits ,because of that pc cant goes in ideal mode, or any other solution on that…
October 06, 2010 at 11:05 am, Chandralalprabu said:
txs its working fine
October 12, 2010 at 4:55 pm, Spencer Dillard said:
Worked like a charm — note that it should be NET START, not SET START. I do sharepoint dev occasionally, and being able to stop/start the 20 or so services is a major help — thanks a bunch
November 01, 2010 at 5:27 pm, Demurphey said:
what about NET START with arguments to start the service as a different user?
May 18, 2011 at 9:58 am, Nssworld said:
I am getting following error…
Any clue why it is happening
System error 5 has occurred.
Access is denied.
September 07, 2011 at 1:49 am, Satish said:
Thanks… its useful
October 23, 2011 at 10:24 pm, joao said:
Hi dear
I am new at working with windows scripting for batch but, I wonder if you could help by sendin a script that starts and then stops my DHCP SERVER?
Thanks
March 15, 2012 at 2:16 am, VIpul said:
Hi ,
Thanks for the Above blog, it was very useful for me!!
Appreciate!!
Thanks,
April 02, 2012 at 6:31 am, Wendy Barnett said:
I have created the .bat files. But how do you run/execute them?
Also new to Windows (old Mianframe person)
April 02, 2012 at 11:05 am, David Kirk said:
@Wendy – You can double-click the batch file to run it or your can simply type the name of the file from the command prompt (just like a .exe or .com file).