Saturday, January 18, 2025
HomeComputer ScienceHow to Restart Service Using Command Prompt?

How to Restart Service Using Command Prompt?

You can restart a service using the Command Prompt on Windows by using the net stop and net start commands or the sc command. Below are the steps and details for restarting a service.

Method 1: Using net Command

  1. Open Command Prompt with Admin Privileges
    • Press Win + S, type “Command Prompt,” and select Run as administrator.
  2. Stop the Service Use the following command to stop the service:
    net stop <service_name>
    

    Replace <service_name> with the actual name of the service.

  3. Start the Service After stopping the service, start it again using:
    net start <service_name>
    
  4. Example To restart the Windows Update service:
    net stop wuauserv
    net start wuauserv
    

Method 2: Using sc Command

The sc (Service Control) command offers more control over Windows services.

  1. Restart Service with sc You can directly restart a service using:
    sc stop <service_name> && sc start <service_name>
    
  2. Example To restart the Print Spooler service:
    sc stop Spooler && sc start Spooler
    
  3. Query the Service Status Before restarting, you can check the current status of the service:
    sc query <service_name>
    

Finding the Service Name

To find the correct service name:

  1. Press Win + R, type services.msc, and press Enter.
  2. Locate the desired service in the list.
  3. Right-click on it, select Properties, and note the Service Name (not the display name).

Automating the Restart Process

You can create a batch file to automate restarting a service:

  1. Open Notepad and enter:
    net stop <service_name>
    net start <service_name>
    
  2. Save the file as restart_service.bat.
  3. Run the batch file as an administrator.

Important Notes

  • Always ensure you have the correct service name, as stopping critical services might impact system stability.
  • For critical services, consider restarting the service during a maintenance window.
RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x