Windows start service from cmd

on August 15, 2010

We normally use Services.msc to start or stop or disable or enable any service. We can do the same from windows command line also using net and sc utilities. Below are commands for controlling the operation of a service.

Command to stop a service:

net stop servicename

To start a service:

net start servicename

You need to have administrator privileges to run net start/stop commands. If you are just a normal user on the computer, you would get an error like below.

C:\>net start webclient
System error 5 has occurred.
Access is denied.
C:\>

To disable a service:

sc config servicename start= disabled

To enable a service:

sc config servicename start= demand

To make a service start automatically with system boot:

sc config servicename start= auto

Note: Space is mandatory after ‘=’ in the above sc commands.

This SC command works on a Windows 7 machine and also on the down-level editions of Windows i.e Windows XP/2003 and Windows Vista. Again, if you do not have administrator previliges you would get the below error.

C:\>sc config webclient start= auto
[SC] OpenService FAILED 5:
Access is denied.

Note that the service name is not the display name of a service. Each service is given a unique identification name which can be used with net or sc commands. For example, Remote procedure call (RPC) is the display name of the service. But the service name we need to use in the above commands is RpcSs.
So to start Remote procedure call service the command is:

net start RpcSsTo stop Remote procedure call service
net stop RpcSs

These service names are listed below for each service. The first column shows the display name of a service and the second column shows the service name that should be used in net start or net stop or sc config commands.

Display Name of the service ServiceName which should be used with ‘net’ and ‘sc config’ commands.
Alerter Alerter
Application Layer Gateway Service ALG
Application Management AppMgmt
ASP.NET State Service aspnet_state
Windows Audio AudioSrv
Background Intelligent Transfer Service BITS
Computer Browser Browser
Bluetooth Support Service BthServ
Bluetooth Service btwdins
SMS Agent Host CcmExec
Indexing Service CiSvc
ClipBook ClipSrv
.NET Runtime Optimization Service v2.0.50727_X86 clr_optimization_v2.0.50727_32
COM+ System Application COMSysApp
Cryptographic Services CryptSvc
Cisco Systems, Inc. VPN Service CVPND
DCOM Server Process Launcher DcomLaunch
DHCP Client Dhcp
Logical Disk Manager Administrative Service dmadmin
Logical Disk Manager dmserver
DNS Client Dnscache
Lenovo Doze Mode Service DozeSvc
Error Reporting Service ERSvc
Event Log Eventlog
COM+ Event System EventSystem
Intel(R) PROSet/Wireless Event Log EvtEng
Fast User Switching Compatibility FastUserSwitchingCompatibility
Windows Presentation Foundation Font Cache 3.0.0.0 FontCache3.0.0.0
Group Policy Monitor GPMON_SRV
Help and Support helpsvc
HID Input Service HidServ
HTTP SSL HTTPFilter
ThinkPad PM Service IBMPMSVC
Windows CardSpace idsvc
IMAPI CD-Burning COM Service ImapiService
iPassConnectEngine iPassConnectEngine
iPassPeriodicUpdateApp iPassPeriodicUpdateApp
iPassPeriodicUpdateService iPassPeriodicUpdateService
IviRegMgr IviRegMgr
Server lanmanserver
Workstation lanmanworkstation
Lenovo Camera Mute LENOVO.CAMMUTE
Lenovo Microphone Mute Lenovo.micmute
TCP/IP NetBIOS Helper LmHosts
Intel(R) Management and Security Application Local Management Service LMS
McAfee Framework Service McAfeeFramework
McAfee McShield McShield
McAfee Task Manager McTaskManager
Machine Debug Manager MDM
Messenger Messenger
NetMeeting Remote Desktop Sharing mnmsrvc
Distributed Transaction Coordinator MSDTC
Windows Installer MSIServer
Net Driver HPZ12 Net Driver HPZ12
Network DDE NetDDE
Network DDE DSDM NetDDEdsdm
Net Logon Netlogon
Network Connections Netman
Net.Tcp Port Sharing Service NetTcpPortSharing
Network Location Awareness (NLA) Nla
NT LM Security Support Provider NtLmSsp
Removable Storage NtmsSvc
Microsoft Office Diagnostics Service odserv
Office Source Engine ose
Plug and Play PlugPlay
Pml Driver HPZ12 Pml Driver HPZ12
IPSEC Services PolicyAgent
Power Manager DBC Service Power Manager DBC Service
Protected Storage ProtectedStorage
Remote Access Auto Connection Manager RasAuto
Remote Access Connection Manager RasMan
Remote Desktop Help Session Manager RDSessMgr
Intel(R) PROSet/Wireless Registry Service RegSrvc
Routing and Remote Access RemoteAccess
Remote Registry RemoteRegistry
Remote Procedure Call (RPC) Locator RpcLocator
Remote Procedure Call (RPC) RpcSs
QoS RSVP RSVP
Intel(R) PROSet/Wireless WiFi Service S24EventMonitor
Security Accounts Manager SamSs
Smart Card SCardSvr
Task Scheduler Schedule
Secondary Logon seclogon
System Event Notification SENS
Windows Firewall/Internet Connection Sharing (ICS) SharedAccess
Shell Hardware Detection ShellHWDetection
Print Spooler Spooler
System Restore Service srservice
SSDP Discovery Service SSDPSRV
Windows Image Acquisition (WIA) stisvc
System Update SUService
MS Software Shadow Copy Provider SwPrv
Performance Logs and Alerts SysmonLog
Telephony TapiSrv
Terminal Services TermService
Themes Themes
ThinkVantage Registry Monitor Service ThinkVantage Registry Monitor Service
Telnet TlntSvr
On Screen Display TPHKSVC
Distributed Link Tracking Client TrkWks
TVT Scheduler TVT Scheduler
Windows User Mode Driver Framework UMWdf
Intel(R) Management & Security Application User Notification Service UNS
Universal Plug and Play Device Host upnphost
Uninterruptible Power Supply UPS
Volume Shadow Copy VSS
Windows Time W32Time
WebClient WebClient
Windows Management Instrumentation winmgmt
Portable Media Serial Number Service WmdmPmSN
Windows Management Instrumentation Driver Extensions Wmi
WMI Performance Adapter WmiApSrv
Security Center wscsvc
Automatic Updates wuauserv
SMS Remote Control Agent Wuser32
Wireless Zero Configuration WZCSVC
Network Provisioning Service xmlprov

How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn’t successful for whatever reason)?

mmcdole's user avatar

mmcdole

91.6k60 gold badges186 silver badges222 bronze badges

asked Sep 25, 2008 at 15:09

Keng's user avatar

0

Use the SC (service control) command, it gives you a lot more options than just start & stop.

  DESCRIPTION:
          SC is a command line program used for communicating with the
          NT Service Controller and services.
  USAGE:
      sc <server> [command] [service name]  ...

      The option <server> has the form "\\ServerName"
      Further help on commands can be obtained by typing: "sc [command]"
      Commands:
        query-----------Queries the status for a service, or
                        enumerates the status for types of services.
        queryex---------Queries the extended status for a service, or
                        enumerates the status for types of services.
        start-----------Starts a service.
        pause-----------Sends a PAUSE control request to a service.
        interrogate-----Sends an INTERROGATE control request to a service.
        continue--------Sends a CONTINUE control request to a service.
        stop------------Sends a STOP request to a service.
        config----------Changes the configuration of a service (persistant).
        description-----Changes the description of a service.
        failure---------Changes the actions taken by a service upon failure.
        qc--------------Queries the configuration information for a service.
        qdescription----Queries the description for a service.
        qfailure--------Queries the actions taken by a service upon failure.
        delete----------Deletes a service (from the registry).
        create----------Creates a service. (adds it to the registry).
        control---------Sends a control to a service.
        sdshow----------Displays a service's security descriptor.
        sdset-----------Sets a service's security descriptor.
        GetDisplayName--Gets the DisplayName for a service.
        GetKeyName------Gets the ServiceKeyName for a service.
        EnumDepend------Enumerates Service Dependencies.

      The following commands don't require a service name:
      sc <server> <command> <option>
        boot------------(ok | bad) Indicates whether the last boot should
                        be saved as the last-known-good boot configuration
        Lock------------Locks the Service Database
        QueryLock-------Queries the LockStatus for the SCManager Database
  EXAMPLE:
          sc start MyService

answered Sep 25, 2008 at 15:15

Ferruccio's user avatar

FerruccioFerruccio

99k38 gold badges226 silver badges299 bronze badges

4

net start [serviceName]

and

net stop [serviceName]

tell you whether they have succeeded or failed pretty clearly. For example

U:\>net stop alerter
The Alerter service is not started.

More help is available by typing NET HELPMSG 3521.

If running from a batch file, you have access to the ERRORLEVEL of the return code. 0 indicates success. Anything higher indicates failure.

As a bat file, error.bat:

@echo off
net stop alerter
if ERRORLEVEL 1 goto error
exit
:error
echo There was a problem
pause

The output looks like this:

U:\>error.bat
The Alerter service is not started.

More help is available by typing NET HELPMSG 3521.

There was a problem
Press any key to continue . . .

Return Codes

 - 0 = Success
 - 1 = Not Supported
 - 2 = Access Denied
 - 3 = Dependent Services Running
 - 4 = Invalid Service Control
 - 5 = Service Cannot Accept Control
 - 6 = Service Not Active
 - 7 = Service Request Timeout
 - 8 = Unknown Failure
 - 9 = Path Not Found
 - 10 = Service Already Running
 - 11 = Service Database Locked
 - 12 = Service Dependency Deleted
 - 13 = Service Dependency Failure
 - 14 = Service Disabled
 - 15 = Service Logon Failure
 - 16 = Service Marked For Deletion
 - 17 = Service No Thread
 - 18 = Status Circular Dependency
 - 19 = Status Duplicate Name
 - 20 = Status Invalid Name
 - 21 = Status Invalid Parameter 
 - 22 = Status Invalid Service Account
 - 23 = Status Service Exists
 - 24 = Service Already Paused

Edit 20.04.2015

Return Codes:

The NET command does not return the documented Win32_Service class return codes (Service Not Active,Service Request Timeout, etc) and for many errors will simply return Errorlevel 2.

Look here: http://ss64.com/nt/net_service.html

Martin R.'s user avatar

answered Sep 25, 2008 at 15:13

Bill Michell's user avatar

Bill MichellBill Michell

8,2703 gold badges29 silver badges33 bronze badges

3

You can use the NET START command and then check the ERRORLEVEL environment variable, e.g.

net start [your service]
if %errorlevel% == 2 echo Could not start service.
if %errorlevel% == 0 echo Service started successfully.
echo Errorlevel: %errorlevel%

Disclaimer: I’ve written this from the top of my head, but I think it’ll work.

answered Sep 25, 2008 at 15:15

Jonas Engström's user avatar

Jonas EngströmJonas Engström

5,0153 gold badges38 silver badges36 bronze badges

0

Instead of checking codes, this works too

net start "Apache tomcat" || goto ExitError

:End  
exit 0  

:ExitError  
echo An error has occurred while starting the tomcat services  
exit 1  

Mr_Green's user avatar

Mr_Green

40.8k45 gold badges160 silver badges271 bronze badges

answered Dec 7, 2013 at 16:45

vanval's user avatar

vanvalvanval

9971 gold badge9 silver badges19 bronze badges

I have created my personal batch file for this, mine is a little different but feel free to modify as you see fit.
I created this a little while ago because I was bored and wanted to make a simple way for people to be able to input ending, starting, stopping, or setting to auto. This BAT file simply requests that you input the service name and it will do the rest for you. I didn’t realize that he was looking for something that stated any error, I must have misread that part. Though typically this can be done by inputting >> output.txt on the end of the line.

The %var% is just a way for the user to be able to input their own service into this, instead of having to go modify the bat file every time that you want to start/stop a different service.

If I am wrong, anyone can feel free to correct me on this.

@echo off
set /p c= Would you like to start a service [Y/N]?
  if /I "%c%" EQU "Y" goto :1
  if /I "%c%" EQU "N" goto :2
    :1  
    set /p var= Service name: 
:2 
set /p c= Would you like to stop a service [Y/N]?
  if /I "%c%" EQU "Y" goto :3
  if /I "%c%" EQU "N" goto :4
    :3  
    set /p var1= Service name:
:4
set /p c= Would you like to disable a service [Y/N]?
  if /I "%c%" EQU "Y" goto :5
  if /I "%c%" EQU "N" goto :6
    :5  
    set /p var2= Service name:
:6 
set /p c= Would you like to set a service to auto [Y/N]?
  if /I "%c%" EQU "Y" goto :7
  if /I "%c%" EQU "N" goto :10
    :7  
    set /p var3= Service name:
:10
sc start %var%
sc stop %var1%
sc config %var2% start=disabled
sc config %var3% start=auto

answered Jun 13, 2015 at 1:31

Nathanial Wilson's user avatar

2

Using the return codes from net start and net stop seems like the best method to me. Try a look at this: Net Start return codes.

bluish's user avatar

bluish

26.4k28 gold badges122 silver badges181 bronze badges

answered Sep 25, 2008 at 15:12

ZombieSheep's user avatar

ZombieSheepZombieSheep

29.6k12 gold badges67 silver badges114 bronze badges

1

Syntax always gets me…. so…

Here is explicitly how to add a line to a batch file that will kill a remote service (on another machine) if you are an admin on both machines, run the .bat as an administrator, and the machines are on the same domain. The machine name follows the UNC format \myserver

sc \\ip.ip.ip.ip stop p4_1

In this case… p4_1 was both the Service Name and the Display Name, when you view the Properties for the service in Service Manager. You must use the Service Name.

For your Service Ops junkies… be sure to append your reason code and comment! i.e. ‘4’ which equals ‘Planned’ and comment ‘Stopping server for maintenance’

sc \\ip.ip.ip.ip stop p4_1 4 Stopping server for maintenance

answered Jan 28, 2014 at 20:52

ATSiem's user avatar

ATSiemATSiem

1,19412 silver badges19 bronze badges

2

We’d like to think that «net stop » will stop the service. Sadly, reality isn’t that black and white. If the service takes a long time to stop, the command will return before the service has stopped. You won’t know, though, unless you check errorlevel.

The solution seems to be to loop round looking for the state of the service until it is stopped, with a pause each time round the loop.

But then again…

I’m seeing the first service take a long time to stop, then the «net stop» for a subsequent service just appears to do nothing. Look at the service in the services manager, and its state is still «Started» — no change to «Stopping». Yet I can stop this second service manually using the SCM, and it stops in 3 or 4 seconds.

answered Feb 10, 2014 at 17:04

DaveH's user avatar

DaveHDaveH

511 silver badge1 bronze badge

or you can start remote service with this cmd : sc \\<computer> start <service>

answered Jan 27, 2012 at 8:56

onionpsy's user avatar

onionpsyonionpsy

1,50211 silver badges15 bronze badges

I just used Jonas’ example above and created full list of 0 to 24 errorlevels. Other post is correct that net start and net stop only use errorlevel 0 for success and 2 for failure.

But this is what worked for me:

net stop postgresql-9.1
if %errorlevel% == 2 echo Access Denied - Could not stop service
if %errorlevel% == 0 echo Service stopped successfully
echo Errorlevel: %errorlevel%

Change stop to start and works in reverse.

answered Feb 12, 2016 at 16:33

Clinton's user avatar

Manual service restart is ok — services.msc has «Restart» button, but in command line both sc and net commands lacks a «restart» switch and if restart is scheduled in cmd/bat file, service is stopped and started immediately, sometimes it gets an error because service is not stopped yet, it needs some time to shut things down.

This may generate an error:
sc stop
sc start

It is a good idea to insert timeout, I use ping (it pings every 1 second):
sc stop
ping localhost -n 60
sc start

answered May 24, 2016 at 8:55

Kuleris's user avatar

KulerisKuleris

1011 silver badge3 bronze badges

Here is the Windows 10 command to start System Restore using batch :

sc config swprv start= Auto

You may also like those commands :

  • Change registry value to auto start System restore

    REG ADD «HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore» /v DisableSR /t REG_DWORD /d 0 /f

  • Create a system restore point

    Wmic.exe /Namespace:\root\default Path SystemRestore Call CreateRestorePoint «djibe saved your PC», 100, 12

  • Change System Restore disk usage

    vssadmin resize shadowstorage /for=C: /on=C: /maxsize=10%

Enjoy

answered Nov 26, 2018 at 19:53

djibe's user avatar

djibedjibe

2,7732 gold badges17 silver badges26 bronze badges

  1. SC
  2. NET STOP/START
  3. PsService
  4. WMIC
  5. Powershell is also easy for use option

SC and NET are already given as an anwests. PsService add some neat features but requires a download from Microsoft.

But my favorite way is with WMIC as the WQL syntax gives a powerful way to manage more than one service with one line (WMI objects can be also used through powershell/vbscript/jscript/c#).

The easiest way to use it:

wmic service MyService call StartService
wmic service MyService  call StopService

And example with WQL

wmic service where "name like '%%32Time%%' and ErrorControl='Normal'" call StartService

This will start all services that have a name containing 32Time and have normal error control.

Here are the methods you can use.

With :

wmic service get /FORMAT:VALUE

you can see the available information about the services.

answered Nov 5, 2020 at 16:15

npocmaka's user avatar

npocmakanpocmaka

55.6k18 gold badges148 silver badges188 bronze badges

SC can do everything with services… start, stop, check, configure, and more…

bluish's user avatar

bluish

26.4k28 gold badges122 silver badges181 bronze badges

answered Sep 25, 2008 at 15:26

Axeman's user avatar

AxemanAxeman

3491 silver badge7 bronze badges

Sometimes you can find the stop does not work..

My SQlServer sometimes does this. Using the following commandline kills it. If you really really need your script to kill stuff that doesn’t stop. I would have it do this as a last resort

taskkill /pid [pid number] /f

answered May 9, 2018 at 9:52

andrew pate's user avatar

andrew pateandrew pate

3,85336 silver badges28 bronze badges

I am writing a windows service in C#, the stop/uninstall/build/install/start loop got too tiring. Wrote a mini script, called it reploy.bat and dropped in my Visual Studio output directory (one that has the built service executable) to automate the loop.

Just set these 3 vars

servicename : this shows up on the Windows Service control panel (services.msc)

slndir : folder (not the full path) containing your solution (.sln) file

binpath : full path (not the folder path) to the service executable from the build

NOTE: This needs to be run from the Visual Studio Developer Command Line for the msbuild command to work.

SET servicename="My Amazing Service"
SET slndir="C:dir\that\contains\sln\file"
SET binpath="C:path\to\service.exe"
SET currdir=%cd%

call net stop %servicename%
call sc delete %servicename%
cd %slndir%
call msbuild 
cd %bindir%
call sc create %servicename% binpath=%binpath%
call net start %servicename%
cd %currdir%

Maybe this helps someone :)

answered Oct 5, 2018 at 18:53

sh87's user avatar

sh87sh87

1,06310 silver badges12 bronze badges

1

I didn’t find any of the answers above to offer a satisfactory solution so I wrote the following batch script…

:loop
net stop tomcat8 
sc query tomcat8 | find "STOPPED"
if errorlevel 1 (
  timeout 1
  goto loop
)
:loop2
net start tomcat8
sc query tomcat8 | find "RUNNING"
if errorlevel 1 (
  timeout 1
  goto loop2
)

It keeps running net stop until the service status is STOPPED, only after the status is stopped does it run net start. If a service takes a long time to stop, net stop can terminate unsuccessfully. If for some reason the service does not start successfully, it will keep attempting to start the service until the state is RUNNING.

answered Nov 25, 2021 at 2:59

Mick's user avatar

MickMick

6,5774 gold badges52 silver badges68 bronze badges

With this can start a service or program that need a service

@echo
taskkill /im service.exe /f
taskkill /im service.exe /f
set "reply=y"
set /p "reply=Restart service? [y|n]: "
if /i not "%reply%" == "y" goto :eof
cd "C:\Users\user\Desktop"
start service.lnk
sc start service
eof
exit

answered Mar 10, 2022 at 17:46

jlberlanga's user avatar


If you manage Windows Services and are comfortable working from the command line, then the Windows NET.EXE command should be in your toolkit. Use it to easily start, stop, pause or restart any service from an elevated command prompt, or in a convenient script/batch file.

Using NET to stop a Windows Service

To stop a service, run:

net stop <Service-Name>

where <Service-Name> is the name of the service. Be sure to enclose it in quotes if it contains a space!

For example, to stop the Print Spooler service (named “Spooler”), run:

net stop Spooler

Here is what it looks like on our Windows Server 2016 computer:

NET: Stopping the Print Spooler Service

Notice that the NET command will wait for the service to stop before continuing. The only exception is when the service is unresponsive or takes more than 30 seconds to comply.

Starting a Windows Service with NET

To start an idle Windows Service, run:

net start <Service-Name>

If all goes well, your service (and any other service it depends on to operate) will be started after a few seconds:

NET: Start the Print Spooler Service

How to Restart a Windows Service with NET.EXE

To restart a service, say from a batch file, chain the “net stop” and “net start” commands together like this:

net stop <Service-Name>
net start <Service-Name>

NET will also Pause and Resume Windows Services

Not all services support pause and resume, but if you have one that does, NET can come in handy there as well.

To pause a service, type:

net pause <Service-Name>

To resume a paused service, run:

net continue <Service-Name>

You may also like…

Windows 10 manage services
Windows 10 manage services
(Image credit: Future)

On Windows 10, services are programs that run in the background without a user interface and enable system features (such as printing, networking, remote access, File Explorer, Windows Search, updates, etc.) and apps to operate as intended.

Although the system does a pretty good job managing background services, you may sometimes need to control them manually when a feature or app isn’t working correctly or requires you to manage its services manually.

Whatever the case might be, Windows 10 includes at least four methods to stop, start, disable, or enable services using the Services console, Task Manager, Command Prompt, and PowerShell.

This guide will walk you through the steps to manage system and app services on Windows 10.

How to manage services from Services console

Using the Services consoles is perhaps the simplest method to stop, start, disable, or enable one or multiple services on Windows 10.

Stop service

To stop a running service using Services, use these steps:

  1. Open Start.
  2. Search for Services and click the top result to open the console.
  3. Double-click the service that you intend to stop.
  4. Click the Stop button.
  • Quick tip: You can also manage the state by right-clicking the service and selecting the option. Or you can select the service and then use the controls at the top to start, stop, pause, or restart.

Stop service on Windows 10

(Image credit: Future)
  1. Click the Apply button.
  2. Click the OK button.

Once you complete the steps, the service will stop running on the device.

If you’re unable to stop a system service, consider that some services are required for the operation of Windows 10, and they can’t be stopped.

Start service

To start a service on Windows 10, use these steps:

  1. Open Start.
  2. Search for Services and click the top result to open the console.
  3. Double-click the service that you intend to stop.
  4. Click the Start button.

Start service on Windows 10

(Image credit: Future)
  1. Click the Apply button.
  2. Click the OK button.

After you complete the steps, the service you specified will start for the current session.

Disable service

To set a service a disabled, use these steps:

  1. Open Start.
  2. Search for Services and click the top result to open the console.
  3. Double-click the service that you intend to stop.
  4. Click the Stop button.
  5. Use the «Start type» drop-down menu and select the Disabled option.

Windows 10 disable service

(Image credit: Future)
  1. Click the Apply button.
  2. Click the OK button.

Once you complete the steps, the service will no longer start automatically after restarting your device.

Enable service

To enable a specific service, use these steps:

  1. Open Start.
  2. Search for Services and click the top result to open the console.
  3. Double-click the service that you intend to stop.
  4. Click the Start button.
  5. Use the «Start type» drop-down menu and select the Automatic option. These are the Startup types on Windows 10:
  • Automatic – service starts at boot.
  • Automatic (Delayed Start) – service start after boot.
  • Manual – starts service manually as needed.
  • Disabled – stops service from running.

Windows 10 automatic service

(Image credit: Future)
  1. Click the Apply button.
  2. Click the OK button.

After you complete the steps, the Windows 10 or app service will enable, but if it was in a stopped state, you’d need to start it manually or restart the device for the service to run.

How to manage services from Task Manager

Task Manager also includes a section to manage services for Windows 10 and apps quickly.

To stop, start, or restart a service using Task Manager, use these steps:

  1. Open Start.
  2. Search for Task Manager and click the top result to open the app.
  • Quick tip: Windows 10 includes many other ways to open the experience, including right-clicking the taskbar and selecting the Task Manager option, and using the «Ctrl + Shift + ESC» keyboard shortcut.
  1. Click the Services tab.
  2. Right-click the service name and select one of the options:
  • Stop.
  • Start.
  • Restart.
  • Quick note: Task Manager only displays the service name, not the display name. For example, if you’re using this method, you’ll the «Print Spooler» defined as «Spooler.»

Task Manager stop, start, restart services

(Image credit: Future)

Once you complete the steps, the service will respond to the option you selected.

How to manage services from PowerShell

You can also use PowerShell commands to manage background services for Windows 10 and apps.

Stop service

To stop a specific service with PowerShell, use these steps:

  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. (Optional) Type the following command to view a list of all the services and press Enter: Get-Service

PowerShell Get Service command

(Image credit: Future)
  1. Type the following command to stop a service and press Enter: Stop-Service -Name «SERVICE-NAME»

For example, this command stops the printer spooler service on Windows 10: Stop-Service -Name «spooler»

In the command, replace «SERVICE-NAME» with the name of the service you intend to stop. If you want to use the display name, replace -Name with -DisplayName and then specify the service’s display name.

Alternatively, you can also use this variant of the command to stop the service: Set-Service -Name «SERVICE-NAME» -Status stopped

In the command, replace «SERVICE-NAME» with the name of the service you intend to stop. If you want to use the display name, replace -Name with -DisplayName and then specify the service’s display name. You only need quotation marks if there’s a space within the name.

PowerShell stop service command

(Image credit: Future)
  • Quick tip: If you’re getting a dependency error, you can append the -force option in either of the commands to stop the service. For example, Stop-Service -Name «SERVICE-NAME» -Force.

After you complete the steps, the PowerShell command will stop the service on your device.

Start service

To start a Windows 10 or app service with PowerShell, use these steps:

  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. Type the following command to start a service and press Enter: Start-Service -Name «SERVICE-NAME»

For example, this command starts the printer spooler service on Windows 10: Start-Service -Name «spooler»

In the command, replace «SERVICE-NAME» with the name of the service. Using the display name is supported, replacing -Name with -DisplayName and specifying the service’s display name.

Alternatively, you can also use this variant of the command to start a service: Set-Service -Name «SERVICE-NAME» -Status running

In the command, replace «SERVICE-NAME» with the name of the service. If you want to use the display name, replace -Name with -DisplayName and then specify the service’s display name.

PowerShell start service

(Image credit: Future)

Once you complete the steps, the service will start on your computer.

Disable service

To disable a service using a PowerShell command, use these steps:

  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. Type the following command to disable a service and press Enter: Set-Service -Name «SERVICE-NAME» -Status stopped -StartupType disabled

In the command, update «SERVICE-NAME» for the name of the service. If you want to use the service’s display name, replace -Name with -DisplayName and specify the service name. If you want to disable the service without stopping it immediately, you can remove the -Status stopped portion of the command. 

For example, this command disables the printer spooler service on Windows 10: Set-Service -Name «spooler» -Status stopped -StartupType disabled

Disable Service PowerShell Command

(Image credit: Future)

After you complete the steps, the PowerShell command will disable the specified service.

Enable service

To enable a specific background service with PowerShell, use these steps:

  1. Open Start.
  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.
  3. Type the following command to enable a service and press Enter: Set-Service -Name «SERVICE-NAME» -Status running -StartupType automatic

For example, this command enables the printer spooler service using PowerShell: Set-Service -Name «spooler» -Status running -StartupType automatic

  • Quick note: You may able to use the display -DisplayName option, but the command may also prompt you to supply the name of the service, adding an extra step to the process. If you want to enable the service without starting it immediately, you can remove the -Status running portion of the command.

Enable Service PowerShell on Windows 10

(Image credit: Future)

Once you complete the steps, PowerShell will enable the service specified with the command.

How to manage services from Command Prompt

If you’re comfortable using the command line, Command Prompt offers the «net» command (older) to stop or start or the «sc» command (newer) to stop, start, disable, or enable services on Windows 10.

Stop service

To stop a Windows 10 or app service with Command Prompt, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. (Optional) Type the following command to view a list of all the services and press Enter: sc queryex state=all type=service

SC command list all services

(Image credit: Future)
  1. Type the following command to stop a service and press Enter: net stop «SERVICE-NAME»

In the command, replace «SERVICE-NAME» with the name or display the name of the service. You only need quotation marks if there’s a space within the name. For example, this command stops the printer spooler using the service name: net stop «spooler»

Alternatively, you can also use the more advanced «sc» command: sc stop «SERVICE-NAME» 

For example, this command stops the printer spooler using the service name: sc stop «spooler»

Command Prompt net stop service

(Image credit: Future)

After you complete the steps, the command will stop the specified service on Windows 10.

Start service

To start a service with the command line, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to start a service and press Enter: net start «SERVICE-NAME»

In the command, replace «SERVICE-NAME» with the name or display the name of the service. You only need quotation marks if there’s a space within the name. For example, this command starts the printer spooler using the service name: net start «spooler»

Alternatively, you can also use the «sc» command: sc start «SERVICE-NAME» 

For example, this command starts the printer spooler using the service name: sc start «spooler»

Command Prompt net start service

(Image credit: Future)

Once you complete the steps, the command will execute and start the service you specified.

Disable service

To disable a service with Command Prompt, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to disable a service and press Enter: sc config «SERVICE-NAME» start=disabled

In the command, replace «SERVICE-NAME» with the name of the service that you want to disable.

For example, this command disables the printer spooler using the service name: sc config «spooler» start=disabled

SC config disable command

(Image credit: Future)
  1. (Optional) Type the following command to stop the service and press Enter: sc stop «SERVICE-NAME»
  • Quick note: When you disable a service, it doesn’t stop the current state of the service. You can either restart your computer or stop the service using the above command.

After you complete the steps, the sc command will run disabling the Windows 10 or app service you specified.

Enable service

To enable a service with a command, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to enable a particular service and press Enter: sc config «SERVICE-NAME» start=auto

In the command, replace «SERVICE-NAME» with the name of the service that you want to enable. For example, this command enables the printer spooler automatically using the service name: sc config «spooler» start=auto

These are alternative commands to enable a particular service:

  • Manual: sc config «SERVICE-NAME» start=demand
  • Automatic Delayed: sc config «SERVICE-NAME» start=delayed-auto

SC config enable command

(Image credit: Future)
  1. (Optional) Type the following command to start the service and press Enter: sc start «SERVICE-NAME»

Once you complete the steps, the service will enable and start automatically on reboot according to the command you used.

You can only use the «net» command to start or stop services. The «sc» command allows you to perform more tasks, including start, stop, enable, or disable services, among other options. If you’re choosing to manage services with command lines, then, in either case, it’s best to use the service name instead of the display name.

Also, when using any of the methods outlined above, consider that making modifications to the default settings can alter the operation of one or more features that depend on that service, negatively affecting the experience. Furthermore, if you restart a service, you might be required to start its dependencies manually as well to make the app or feature operational again.

We’re focusing this guide on Windows 10, but the ability to manage services has been available for several years, which means that you can refer to this guide if you’re still running Windows 8.1, Windows 7, and older versions.

More resources

For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:

  • Windows 11 on Windows Central — All you need to know
  • Windows 10 on Windows Central — All you need to know

Windows 11 Logo Se

Cutting-edge operating system

A refreshed design in Windows 11 enables you to do what you want effortlessly and safely, with biometric logins for encrypted authentication and advanced antivirus defenses.

All the latest news, reviews, and guides for Windows and Xbox diehards.

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he’s a recognized member of the Microsoft MVP community.

The services in Windows can be started using the Service Manager tool.

To start the Service Manager GUI, press ⊞ Win keybutton to open the start menu, type in services to search for the Service Manager and press Enter to launch it.

The services can also be started using the command-line prompt (CMD) or the PowerShell.

In this note i am showing how to start, stop or check the status of a service in Windows using the command-line prompt (CMD) or the PowerShell.

Cool Tip: List services in Windows from the CMD & PowerShell! Read more →

Start Service Using Command Line (CMD)

To avoid “Access is denied” errors, start CMD as an administrator: press ⊞ Win keybutton to open the start menu, type in cmd to search for the command prompt and press Ctrl + Shift + Enter to launch it as administrator.

Use the following commands to start, stop or check the status of a service in Windows on the command-line prompt (CMD).

Start a service:

C:\> net start serviceName

Get a service status:

C:\> sc query serviceName

Stop a service:

C:\> net stop serviceName

Cool Tip: Kill a hanging process in Windows from the CMD! Read more →

To avoid “Access is denied” errors, start PowerShell as an administrator: press ⊞ Win keybutton to open the start menu, type in powershell to search for the PowerShell and press Ctrl + Shift + Enter to launch it as administrator.

Use the following commands to start, stop or check the status of a service in Windows using the PowerShell.

Start a service:

PS C:\> Start-Service serviceName

Get a service status:

PS C:\> Get-Service serviceName

Stop a service:

PS C:\> Stop-Service serviceName

Was it useful? Share this post with the world!

  • Windows store xbox и xbox identity скачать для windows 10
  • Windows split file by lines
  • Windows start program from cmd
  • Windows store не дает установить программу
  • Windows spirit host что это