您一定至少曾经想过,是什么让Windows 运行(Windows run)并为这么多不同的应用程序提供如此多的功能?答案的一个关键部分是由Windows服务提供的。通过使用其服务,Windows可以管理网络连接、通过扬声器播放声音(play sound)、记住密码和凭据、在屏幕上显示颜色等等。在本文中,我们将描述什么是Windows服务以及使用它们的基础知识。如果您想了解有关Windows服务的更多信息,请继续阅读:
什么是 Windows 服务?
服务是几乎(almost)与其他任何应用程序一样的应用程序。服务和其他程序之间的区别在于它们在后台运行并且没有可以单击或点击的用户界面。它们旨在提供操作系统(operating system)功能,例如Web 服务(web serving)、事件记录(event logging)、文件服务(file serving)、打印或错误报告(printing or error reporting)。
并非所有服务都是由Microsoft开发的。一些应用程序和驱动程序安装它们的服务。安全(Security)套件就是一个很好的例子,因为它们安装不同的服务来提供对系统活动的实时监控、反恶意软件保护、防火墙保护(firewall protection)等。它们需要利用服务提供的优势。其中一个优点是它们可以在系统启动(system boot)期间、在其他程序之前甚至在您登录之前启动。但是,最重要的优点是它们可以监控您计算机上运行的所有内容,同时完美地集成到Windows 核心(Windows core)中。这样,它们可以提供高水平的保护。
另一个非 Microsoft 服务的示例可能是SSH 服务器(SSH server),通常在办公室中用于安全远程连接或 Web 浏览器的自动更新服务,例如 Firefox 使用的Mozilla(Firefox)维护服务(Mozilla Maintenance Service)。
了解服务做什么或何时做某事可能很有用。例如,如果您知道您不需要它的功能,您可以禁用它以加速您的系统。如果您安装了路由器来管理您的本地网络,那么您可能不需要运行Internet 连接共享(Internet Connection Sharing)服务。
或者,如果您需要运行某个服务,但它并不那么重要,您可以将其设置为稍后启动,在Windows、启动应用程序(startup apps)或其他更关键的服务启动之后。就我而言,我们需要但我们的生活并不依赖它的服务之一是Windows 时间(Windows Time)服务,它可以同步Windows 和应用程序(Windows and apps)的日期和时间(date and time)。所以我们决定将其设置为延迟(Delayed)启动。
如何访问 Windows 服务?
访问Windows(Windows)服务的方式有很多种。但是,我们不打算全部描述它们,因为我们已经在之前的指南之一中进行了描述,您可以在此处找到:在Windows中访问(Windows)服务(Services)的 9 种方法(所有版本)。
但是,如果您没有时间阅读完整指南,请知道在任何最新的Windows 版本中打开(Windows version)服务(Services)的一种快速方法是使用搜索。在Windows 10(Windows 10)的任务栏的搜索字段(search field)中输入单词services,从 Windows 8.1开始在开始屏幕上(Start)键入(start typing)services ,或在Windows 7的(Windows 7)开始菜单(Start Menu )的搜索字段中键入services。在所有这些操作系统中,单击或点击(click or tap)服务(Services)或“查看本地服务”("View local services")搜索结果。然后, 服务(Services)窗口打开。
服务(Services)窗口是您可以查看、启动、停止和配置所有Windows服务的地方。
如何查看有关Windows 服务(Windows service)的信息?
在“服务(Services)”窗口中,对于列出的每个服务,您可以看到五项内容:
-
名称(Name)- 如果您想了解该服务的功能,该服务的名称可能会有所帮助。但不幸的是,这个名称通常过于神秘,无法帮助您了解服务的全部内容。
-
描述(Description)- 服务描述显示有关服务目的或身份的一些简要信息。
-
状态(Status)- 告诉您该服务是正在运行还是已停止。
-
启动类型(Startup Type)- 显示 Windows 如何启动该服务。服务可以自动启动,但有延迟,手动启动,也可以禁用,这意味着它们永远不会启动。我们将在本教程的后面部分详细讨论 Windows 服务的启动类型以及如何配置它。
-
登录(Log On As)身份- 允许您选择是使用本地系统(Local System)帐户还是使用您手动指定的另一个用户帐户启动服务。
请注意,您还可以通过在“服务(Services)”窗口中双击(或双击)其名称,在每个服务的“属性”中看到相同的信息。(Properties)
如何启动或停止Windows 服务(Windows service)
启动或停止服务很容易:您只需右键单击服务(或点击并按住(tap and hold))并选择所需的操作。要执行服务,请按Start。
如果要停止正在运行的服务,则必须按停止(Stop)选项。
除了启动(Start )和停止(Stop)还有其他一些可用选项:您还可以暂停、恢复(Pause, Resume)或重新启动(Restart)选定的服务。最后一个选项是不言自明的,至于Pause:这意味着服务已停止,但仅适用于没有管理或服务权限的用户帐户,而后者仍然运行。自然,Resume会为这些帐户启动暂停服务。
您选择的操作仅适用于您当前的计算会话(computing session)。重新启动 Windows 后,所选服务将恢复到其默认状态(default state)。
注意:(NOTE: )还有另一种启动或停止服务的方法:您也可以从服务的“属性(Properties)”窗口执行此操作。右键单击(Right-click)(或按住(press and hold))该服务,然后单击Properties。然后,在“常规(General)”选项卡中,您应该会找到与右键菜单中相同的选项。
如何更改Windows 服务(Windows service)的启动类型(startup type)
要更改Windows 服务(Windows service)的启动方式,您必须首先打开其属性。(Properties.)为此,请右键单击(或按住(press and hold))服务,然后单击Properties。
在服务的“属性(Properties)”窗口中,“常规(General)”选项卡共享有关服务名称、显示名称(display name)、描述、其可执行文件的路径以及修改其启动类型(startup type)的选项的信息。第二部分共享服务的状态,并允许您在需要时指定自定义启动参数。
您可以将启动类型(Startup type)设置为:
尽管您可以这样做,但我们建议您不要更改服务的启动类型(Startup type),除非您知道自己在做什么。将服务设置为Disabled尤其危险,因为其他系统组件可能依赖于它。这可能导致操作系统或应用程序(operating system or app)出现故障,甚至无法启动。
此外,如果您需要有关可以安全禁用哪些服务的指导,您应该阅读以下文章:
- Windows服务 –识别(Identifying)依赖关系和更改启动类型(startup type)
- 哪些Windows服务可以安全禁用以及何时禁用?
您是否管理 Windows PC 上的服务?
如果您需要充分发挥性能并加快系统速度,某些服务可能会延迟甚至禁用。但是,只有当您不需要或根本不需要这些服务时才有可能,并且禁用它们不会给您带来问题或不便。我们现在想到(mind right)的问题是:您是自己在 PC 上管理Windows服务,还是更愿意让它们保持不变?在下面发表评论(Comment),让我们讨论。
What are Windows services, what do they do and how do you manage them?
You must have wondered at least onсe about what makes Windows run and offer so many features to ѕo many different apps? One crucial part of the answer is provided by the Windows services. By using its services, Windows can managе network connections, play sound through the speakers, remember passwordѕ and credentials, display colorѕ оn the screen and so on. In this article, we are going to describe what Windows servіces are and the basics of working with them. If you want to lеarn more aboυt Windows services, read on:
What are Windows services?
A service is an application almost like any other. The difference between services and other programs is that they run in the background and do not have a user interface that you can click or tap on. They are intended to provide 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 services. Security suites are an excellent example, as they install different services to provide real-time monitoring of your system's activities, anti-malware protection, firewall protection, etc. They need to use the advantages offered by services. One such advantage is that they can be started during the system boot, before other programs and even before you log in. However, the most important advantage is that they can monitor everything that runs on your computer while being perfectly integrated into the Windows core. This way, they can provide a high level of protection.
Another example of a non-Microsoft service could be an SSH server, often used in offices for secure remote connections or an auto-updating service for your web browser like the Mozilla Maintenance Service used by Firefox.
Knowing what or when a service does something can be useful. For example, if you know that you are 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 is likely that you do not need the Internet Connection Sharing service to run.
Alternatively, if you need a service to run, but it is not that important, you can set it to start a little bit later, after Windows, startup apps or other, more critical services, have started. In my case, one of the services we need but our lives do not depend on it, is the Windows Time service, which synchronizes the date and time for Windows and apps. So we decided to set it to a Delayed startup.
How to access Windows services?
There quite a few different ways of accessing the Windows services. However, we do not intend to describe them all, because we already did it in one of our previous guides, which you can find here: 9 ways to access Services in Windows (all versions).
However, if you do not have the time to read the full guide, know that one fast way of opening the Services in any recent Windows version, is to use the search. Enter the word services in the search field from the taskbar in Windows 10, start typing services on the Start screen from Windows 8.1, or type services in the search field from the Start Menu in Windows 7. In all these operating systems, click or tap on the Services or "View local services" search results. Then, the Services window opens.
The Services window is the place where you can view, start, stop and configure all the Windows services.
How to view information about a Windows service?
In the Services window, for each of the services listed, you can see five things:
-
Name - The name of the service can be helpful if you want to get an idea of what that service does. Unfortunately, though, this name is often too cryptic to help you understand what the service is all about.
-
Description - The description of the service shows some brief information about the service's purpose or identity.
-
Status - Tells you whether that service is running or if it is stopped.
-
Startup Type - Shows you how that service is started by Windows. Services can be launched automatically, automatically but with a delay, manually, or they can be disabled, which means that they are never started. We will talk more about the startup type of Windows services and how to configure it, later in this tutorial.
-
Log On As - Lets you select whether the service is started using the Local System account or using another user account that you manually specify.
Note that you can also see the same information in the Properties of each service, by double-clicking (or double-tapping) on its name in the Services window.
How to start or stop a Windows service
Starting or stopping a service is easy: all you have to do is right-click the service (or tap and hold) and select the desired action. To execute a service, press Start.
If you want to stop a running service, you have to press the Stop option.
Besides Start and Stop there are some other options available: you can also Pause, Resume or Restart the selected service. The last option is self-explanatory, as for Pause: it means that the service is stopped, but only for user accounts that do not have administrative or service privileges, while it still runs for the latter. Naturally, Resume starts a paused service for those accounts.
The action you chose is applied only to your current computing session. After you restart Windows, the selected service resumes to its default state.
NOTE: There is an alternative way of starting or stopping a service: you can also do it from the service's Properties window. Right-click (or press and hold) on the service and then on Properties. Then, in the General tab, you should find the same options as in the right-click menu.
How to change the startup type of a Windows service
To change the way a Windows service starts, you must first open its Properties. To do that, right-click (or press and hold) on the service and then on Properties.
In the service's Properties window, the General tab shares information about the service's name, the display name, description, the path to its executable and the option to modify its startup type. The second section shares the status of the service and lets you specify custom start parameters if needed.
You can set the Startup type to be:
-
Automatic: the service starts at boot time.
-
Automatic (Delayed Start): the service starts only after the system has loaded all the other services set to start automatically.
-
Manual: the service starts only when it is needed.
-
Disabled: the service never starts, even when its functionality is requested by other Windows services or apps.
Although you can do it, we recommend you not to change the Startup type for your services, unless you know what you are doing. It is especially dangerous to set a service to be Disabled, as other system components may depend on it. This can lead to a malfunctioning operating system or app, or even failure to boot.
Also, if you need some guidance on what services are safe to disable, you should read these articles:
Do you manage the services on your Windows PC?
Some services can be delayed or even disabled if you need to squeeze every bit of performance and to speed up your system. However, that is possible only if you do not need those services right away or not at all, and disabling them does not cause you problems or inconveniences. The question we have in mind right now is: are you managing the Windows services by yourself on your PC or do you prefer to leave them all untouched? Comment below and let's discuss.