How do I stop a service from the command line?

This functions shuts down a Windows[R] Service.

The following steps summarize the graphical method for a local machine only:

  1. Open the Service Control Manager.
  2. Select the service to be stopped.
  3. If the service is running, select the service in the list box to enable the Stop button. Click Stop.
  4. Click Yes when you are prompted for confirmation to stop the service.

    In some cases, there might be other services dependent on the service you are trying to stop. If so, the service control manager should stop them automatically as well.

  5. If no errors occur, the status of the service should change to stopped in the list. If so, the service is stopped and no further actions are necessary. If you see an error stating that the service is not responding to the control function, the status might or might not be set to stopped. In either case, check for the process of the service to ensure it is actually not running. If it is running, stop the process manually. Do not stop the MSSQLServer service.
  6. If the service is running, but when you highlight it in the service list, the Stop button is not enabled, then the service must stop the process. If you are still unable to stop the process, restart the system.

The following steps summarize a second graphical method:

  1. Open the Windows Server Manager.
  2. On the Computer menu, select the Services menu item.
  3. Refer to steps 2-6 in the preceding graphical method for the additional steps.

The following steps summarize the command line method:

  1. At the command prompt, enter the following command:sc \\hostname query service_name
  2. If the STATE row of the output is RUNNING or PAUSED, enter the following command:sc \\hostname stop service_nameto stop the service.
  3. Enter the following command again:sc \\hostname query service_name
  4. If the service is showing a state of STOP_PENDING, continue running this command until the service state is shown as STOPPED. If the service state does not go to STOPPED within a reasonable period of time, stop the process.

You can use the net stop command. The net stop command provides a synchronous command line method of stopping a service locally, but the sc command is preferred.

[ Top of Page | Previous Page | Next Page | Contents | Index ]

Video liên quan

Chủ Đề