i would like to stop following services from command line
- print spooler
- shell harware detection
- windows defender
- windows update
- onedrive onecloud
and also deny them from running at startup (as i set to disabled in mmc)
Failed to find an generic answer, so how to stop them from command lime .cmd file? Also, will it be required to run as admin?
43 Answers
To stop a service use net stop <service name>
To start a service use net start <service name>
Both these need running from a elevated prompt.
To disable a service use sc config "Name of Service" start= disabled
This also needs running from a elevated prompt.
Finally, a list of services and their states is in the registry at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
Or
You can type services.msc into cmd line and it'll give you a list
(Thanks @D.A !)
3Interacting with services requires administrative privileges.
To view a list of installed services, type (this command does not require administrative privileges):
net startPowershell can also be used, then it would be:
get-service | select NameTo start a service, type:
net start <name of service>Or using powershell:
start-service -name <short name of service>
start-service -displayname <long name of service>To stop a service, type:
net stop <name of service>Or using powershell:
stop-service -name <short name of service>
stop-service -displayname <long name of service>Note, services have a long and short name. For example: "Windows Update" is also known as wuauserv. Typing a service that contains a space needs to be quoted.
To modify the startup type of a service (example Automatic or disabled) use:
sc config "<name of service>" start=auto
sc config "<name of service>" start=disabledOr using Powershell:
Set-Service -Name <short name of service> -StartupType automatic
Set-Service -DisplayName <long name of service> -StartupType disabledThe -name and -displayname obviously work for both setting the startup type to automatic and disabled, its just an example.
Given that you also mention Microsoft OneDrive, keep in mind that OneDrive is very stubborn and will likely be able to activate itself when you open the explorer. If you don't want to use OneDrive, consider going to start->Add/remove programs, and uninstall Microsoft OneDrive.
Two commands for killing services:
net startto get a name list of running servicesnet stop "name of service"to stop the service
A service is a programm almost like any other. The difference between services and other programs is that they run in the background and don’t have a user interface you can click or tap on. They are intended to provide core operating system features such as Web serving, event logging, file serving, printing or error reporting.
Not all services are developed by Microsoft. Some applications and drivers install their own services. Security suites are a very good example, as they install different services to provide real-time monitoring of your system’s activities, firewall protection, etc. These suites need to use the advantages provided by services. One such advantage is that they can be started during the system boot, before other programs and even before you log in. But the most important advantage is that they can monitor everything that runs on your computer while being perfectly integrated in the Windows core. This way, they can provide a very high level of protection.
Another example of a non-Microsoft service could be a SSH server, often used in offices for secure remote connections or an auto-updating service for your web browser like the Mozilla Maintenance Service.
Knowing what or when a service does something can be useful at times. For example, if you know you’re not going to need its features you can disable it to speed up your system. If you have a router installed to manage your local network, it’s likely that you don’t need the Internet Connection Sharing service to run. Or, if you need a service to run, but it’s not that important, you can set it to start a little bit later, after Windows, startup apps or other, more important services, have started. In my case, one of the services I need but my life doesn’t depend on it, is the Windows Time service, which synchronizes the date and time. So I decided to set it to a Delayed startup.
What is a Service? Definition of a Windows Service & Instructions on Controlling ServicesUnderstanding and Managing Windows Services
3