Latest Gyan

Essential Tools for Windows Services: The NET Command

If you manage Windows Services and are comfortable working from the command line, then the Windows NET.EXE command should be in your toolkit. Use it to easily start, stop, pause or restart any service from an elevated DOS prompt, or as part of a convenient script/batch file.

Using NET to stop a Windows Service

To stop a service, run:
net stop <Service-Name>
where <Service-Name> is the name of the service. Be sure to enclose it in quotes if it contains a space!
For example, to stop the Print Spooler service (named “Spooler”), run:
net stop Spooler

NET: Stopping the Print Spooler Service

Notice that the NET command will wait for the service to stop before continuing. The only exception is when the service is unresponsive or takes more than 30 seconds to comply.

Starting a Windows Service with NET

To start an idle Windows Service, run:
net start <Service-Name>
If all goes well, your service (and any other service it depends on to operate) will be started after a few seconds.

How to Restart a Windows Service with NET.EXE

To restart a service, say from a batch file, chain the “net stop” and “net start” commands together like this:
net stop <Service-Name>
net start <Service-Name>

NET will also Pause and Resume Windows Services

Not all services support pause and resume, but if you have one that does, NET can come in handy there as well.
To pause a service, type:
net pause <Service-Name>
To resume a paused service, run:
net continue <Service-Name>

कोई टिप्पणी नहीं:

एक टिप्पणी भेजें