Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Use the SC Command to Manage Windows Services via CMD

The SC (Service Control) command is a powerful tool in Windows that allows users to manage services from the command line. This command can be used to create, start, stop, delete, and configure Windows services, making it an essential tool for systems administrators and power users who need to automate service management tasks.

Understanding the SC Command

The SC command can be executed in the Command Prompt (CMD) or PowerShell. It provides a wide range of functionalities for managing Windows services, which are background processes that can be started automatically at boot time or manually by a user or application.

Practical Examples

1. Querying a Service

To check the status of a service, you can use the sc query command followed by the service name. For example, to check the status of the "Windows Update" service:

sc query wuauserv

This command will return information about the service, including whether it is running, stopped, or paused.

2. Starting a Service

To start a service, use the sc start command:

sc start wuauserv

This command will start the Windows Update service if it is not already running.

3. Stopping a Service

To stop a service, use the sc stop command:

sc stop wuauserv

This command will stop the Windows Update service if it is currently running.

4. Creating a New Service

To create a new service, you can use the sc create command. You will need to specify the service name, the display name, and the path to the executable. Here is an example:

sc create MyService binPath= "C:\Path\To\MyService.exe" DisplayName= "My Custom Service"

Note the space after binPath= and DisplayName=. This syntax is required for the command to work correctly.

5. Deleting a Service

To delete a service, use the sc delete command:

sc delete MyService

This command will remove the service named "MyService" from the system.

6. Configuring a Service

To change the configuration of an existing service, such as its startup type, use the sc config command. For example, to set a service to start automatically, use:

sc config wuauserv start= auto

Again, note the space after start=.

Additional Tips

  • Always run the Command Prompt as an administrator when using the SC command to ensure you have the necessary permissions to manage services.
  • Use the sc command with caution, as improper use can affect system stability.
  • For detailed help on the SC command, type sc /? in the Command Prompt.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.