Most users have never heard of services or even know what they do. Essentially, a service is a chunk of software that runs in the background and performs specific functions for your computer. Services can be used to perform tasks like opening new windows on websites. Most users will use this power wisely only if they’re educated about how it works and what happens when something goes wrong with them.
Managed services are a way to centrally manage and control computer system resources, such as installing software updates. This article will show you how to use the Command Prompt in Windows to manually start managed services on your computer or remote machines.
The “how to start services in windows 10 using command prompt” is a tutorial that will teach you how to start, stop, and restart Windows Services from the Command Prompt.
At some time, every Windows administrator will have to deal with Windows services. When scripting Windows services, command-line utilities like net stop and the sc command come in helpful for automating service administration.
In this article, you’ll learn how to control Windows services from the command line in a variety of ways.
Let’s get this party started!
Prerequisites
If you want to follow along with this lesson, you’ll need the following items:
- A PC with Windows 7 or above. The instruction will be performed on a PC running Windows 10 Build 2004.
Names of Services to Look For
Because the net and sc commands are both command-line tools, finding the actual service names to deal with isn’t always easy. You must give a service name, not the service display name, for both instructions. The service name may be found in the services.msc console, as illustrated below.
In the services.msc console, type the name of the service.
Using the SC Command to Manage Services
Let’s get started with the sc command in this service management lesson. For a long time, Windows has included the sc command as a built-in command-line utility. From the command prompt, this command can handle all you need to control Windows services.
All commands in this section will also work on remote computers. To run sc against a remote computer, specify the computer name in the command e.g. sc \REMOTENAME <some command>.
1. Open a command prompt as administrator to begin.
2. Use the sc query command to do a search. The sc query command searches for and displays information about all Windows services, including their name (SERVICE NAME), display name (DISPLAY NAME), status, and more. If you don’t know the service name, use sc query to look it up.
Use the sc query command to do a search.
3. Once you’ve determined which service you’d want to work with, attach the name to the sc query as shown below to restrict the output to just that service. The Windows Update Agent service is STOPPED, as you can see below.
Using the wuauserv service to make a request
4. Finally, start the service by typing sc start followed by the service’s name. When you do, you’ll see that Windows starts the service in the START PENDING state. start wuauserv sc
wuauserv service is now available.
5. After a few seconds, use sc query to verify the service’s status. The service should now be up and running.
Using the wuauserv service to make a request status
6. In the same way that you can start a service with the sc command, you can also end a service with the sc stop command. The service will be in the STOP PENDING state. Check the status with sc query again after a few seconds.
wuauserv sc wuauserv sc wuauserv sc wuauserv sc inquiry
wuauserv service is being turned off.
7. Rather of shutting down the service, you could choose to suspend it. Simply use the sc pause command in such instance. You’ll see that the service falls into a PAUSED status right away. The apphostcsv service is used as an example in the following example.
Pausing is not supported by any of the services. By executing sc query and confirming the service has a PAUSABLE state, you can locate all services that allow pausing.
Using SC pause to pause a service
The service would then be halted in the Windows services applet.
Checking the AppHostSvc service’s pause
A service’s internal state and cache information are maintained while it is operating. When the service is terminated, it clears the cache and its internal state. When the service is halted, the cache and internal state are preserved.
8. Run the sc continuecommand to restart a service that has been suspended or halted. The service will then instantly return to the RUNNING state. sc apphostsvc continue
Keeping the apphostsvc service running
Using the NET Command to Manage Services
The net command is one of the most basic and useful Windows admin tools. The net command has several capabilities, but one of them is interacting with services. With a single command, such as sc, you may stop, start, pause, and restart services using the net command.
How to Use Net Use to Connect to Network Drives from the Command Line
As an example, the BITS and Windows Update services will be used in this section.
On a Windows computer, perform the following:
1. Log in as an administrator to a Command Prompt.
2. Stop the BITS service using the net stop command, specifying the service name to stop. When you use net stop to stop a service, it will first enter a pending state, then a stopped state if all goes well.
Unlike the sc command, net does not have the ability to inquire the status of services.
BITS service will be discontinued.
3. Replace stop with start to restart the service, and net will have the reverse effect. launch BITS on the internet
BITS service will be launched.
You’ll receive a notice that says “The requested service has already been started” if the service is already running. Similarly, if the service is stopped and you try to restart it, you’ll get the notice “The service is not started.”
4. To halt a running service, use the net pause command, which is equivalent to sc. Use the continue command to continue.
net AppHostSvc stop continue net AppHostSvc
AppHostSvc service is currently being paused.
Keeping the apphostsvc service running
Managing a number of services at the same time
You worked with a single service in the previous sections. You may expand the capabilities of the command prompt’s built-in construct to interact with many services at once.
To handle many services at the same time:
Create a text file with each service you’d want to start or stop separated by a new line, similar to the one below. This text file will be read by the for construct. This file will be stored to the C:Temp directory.
Run the command shown below. This command is made up of six parts:
- For the declaration of construct
- The /F switch is used to indicate that a file should be read.
- Tokens is a string that specifies which things in each line of the text file should be processed. In this situation, the example utilizes * to indicate that the complete line should be read.
- To indicate which file to read, use the in operator and the file path.
- The do construct instructs the for construct to perform a command.
- A placeholder (percent A) for each line in the text file that represents each line in the text file as it is processed by the for construct.
The command prompt in the example below reads the C:TempServices.txt file, which contains line-delimited service names, and executes service commands against each service in the file.
do sc start ” percent A” for /F “tokens=*” percent A in (c:TempServices.txt) do net start ” percent A” for /F “tokens=*” percent A in (c:TempServices.txt) do sc query ” percent A” for /F “tokens=*” percent A in (c:TempServices.txt) do net start ” percent A” for /F “to
Multiple services are being launched.
Conclusion
You learned how to control Windows services using the net and sc Windows commands in this article. You should now be able to use the command prompt to stop, start, pause, and restart Windows services.
Why not take it a step further and learn how to use PowerShell to control Windows services?
The “how to open services.msc from command prompt” is a tutorial that teaches users how to manage Windows Services from the Command Prompt. It includes screenshots and step-by-step instructions.
Frequently Asked Questions
Related Tags
- how to restart services in windows using cmd
- how to enable all services in windows 10
- how to stop services in windows 10 from command line
- batch script to stop and start windows services
- how to check running services in windows from command line