How to control the operation of Windows services
Windows service operations are actions that can be performed against a service, such as starting, stopping, pausing, or resuming. These operations can affect the state and functionality of the service.
To control the operation of Windows services, we can use the sc command by adding the name of the service and the desired operation as parameters. This command sends the request to the service and displays the results.
Here’s an example of how to start service Windows Audio:
C:\Windows\system32>sc start Audiosrv SERVICE_NAME: Audiosrv TYPE : 20 WIN32_SHARE_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 1508 FLAGS :
From the output above, we can see that the command successfully sent a request to start the service Audiosrv and that the service is in the process of starting (START_PENDING).
Here is a list of operations that can be used as parameters in sc command:
- start: This service will start if the service has a status of STOPPED.
- stop: This service will be terminated if it has a status of RUNNING, PAUSED, START_PENDING, or CONTINUE_PENDING.
- pause: This service will be paused if the service is RUNNING or CONTINUE_PENDING.
- continue: This service will continue if the service is PAUSED or PAUSE_PENDING.
Conclusion
By using CMD, we can manage Windows services easily and quickly. We can view the list and status of services, change the startup mode of the service, and control the operation of the service using the commands we discussed above. Thus, we can improve the performance and security of our system according to our needs.