How to manipulate windows services via command line

If you ever wondered how to start / stop / change Startup Type of a service, keep reading this...

How to start and stop a Service

Windows XP/Vista/7 (I'm not sure about earlier versions) allow you to start and stop services via command line with the help of command net start to start a service and net stop to stop the service.
For example, if you want to start Telnet service run the following command:

net start tlntsvr

and if you want to stop in the future, run this command:

net stop tlntsvr

How to change Service's Startup Type

There are some services that will get resurrected by some applications that depend on those services. McAfee Virus Scan is one of those apps. If it will notice that McShield is not running, it will start it back up. In order to prevent that from happening, you can change McShield's startup type to Manual and thus preventing anything from starting.
To achieve that, a registry modification will need to performed. Location of the value to be changed is as follows:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[name of your service]\Start

Possible values for that key are:

2 = Automatic
3 = Manual
4 = Disabled

So, to change startup type of McShield service, type in the following command to command prompt:

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\McShield /v Start /t REG_DWORD /d 3 /f

Comments