Start and Stop Service via Command Line In Windows

Windows is a modern operating system that heavily uses services to accomplish different tasks and provides different services. The Windows services generally started and stopped in the background according to their configuration or automated scripts. We can also start and stop services in Windows operating system by using the command line interfaces MS-DOS or PowerShell. In this tutorial, we examine how to start and stop services with the MS-DOS and Powershell command line interfaces.

List Services in MS-DOS (Command Prompt)

Before starting or stopping services it can be useful to list services to find a service exact name to prevent errors. The sc query command can be used to list services in the MS-DOS command prompt.

> sc query
List Services in MS-DOS (Command Prompt)

From the output, we can see that the service canonical name is displayed with the SERVICE_NAME line.

Start Service in MS-DOS (Command Prompt)

We can start a service by using the MS-DOS command line interface with the net start command below. In the following example, we start the service named Appinfo .

> net start Appinfo

Stop Service in MS-DOS (Command Prompt)

We can stop a Windows service via the MS-DOS command prompt with the net stop command. In the following example, we stop the service named Appinfo .

> net stop Appinfo

List Services in PowerShell

We can list the services in PowerShell by using the Get-Service command. The Get-Service command list all services with their status, name, and display name information.

PS> > Get-Service

We should use the Name of the service in order to start and stop it.

Start Service in PowerShell

We can use the Start-Service command in order to start a service in PowerShell. We should provide the service name as a parameter to the Start-Service command. In the following example, we start the service Appinfo.

PS> Start-Service Appinfo

Stop Service in PowerShell

We can stop a service in Powershell by using the Stop-Service command.

PS> Stop-Service Appinfo

Leave a Comment