It is very convenient to have a batch file to start and stop specific Windows services for certain needs.
e.g. I run MS SQL 2000 and MS SQL Express. I only need these services when I am doing some demo to the clients. I do not need these services running all the time, possibly slowing down my computer.
The commands are:
NET START – starts the service
NET STOP – ends the service
The command syntax is as follows:
NET START Service Name
NET STOP Service Name
I created two batch files – one to start the services and one to stop the services.
The batch file to start the services had the following contents:
NET START MSSQLSERVER
NET START MSSQL$SQLEXPRESS
The batch file to stop the services had the following contents:
NET STOP MSSQLSERVER
NET STOP MSSQL$SQLEXPRESS
I had to right click on the batch file and select Run As Administrator option as it needs administrator privileges to start and stop the services.
How to find out the names of the services?
Go to Start -> Control Panel -> Administrative Tools -> Services
Right click on the service you want and select Properties. Under General tab you will find the service name.
WARNING: Please be careful when you start or stop services as these may have unintended consequences if you do not fully understand what the service is for. Therefore first read about the service and understand whether it is safe to start/stop it for your purposes.