如何从注册表中得知服务的状态

如何从注册表中得知服务的状态

举个例子,我想从注册表中找出我的蓝牙服务处于什么状态:

  1. 我会使用regedit
  2. 查找路径:SYSTEM\CurrentControlSet\Services\BTHPORT

我如何知道蓝牙服务是手动、禁用还是启用?

答案1

通过注册表,您无法知道服务当前处于什么状态,只能知道其启动模式设置(手动、自动、禁用等)。这些信息将保存在注册表中服务分支内名为“Start”的键中。

可能的值:

+-------+----------------------------------------------------------------------------------------------------------------------------------+
| Value |                                                           Description                                                            |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
|     0 | Boot: Loaded by kernel loader. Components of the driver stack for the boot (startup) volume must be loaded by the kernel loader. |
|     1 | System: Loaded by I/O subsystem. Specifies that the driver is loaded at kernel initialization.                                   |
|     2 | Automatic: Loaded by Service Control Manager. Specifies that the service is loaded or started automatically.                     |
|     3 | Manual: The service does not start until the user starts it manually, such as by using Services or Devices in Control Panel.     |
|     4 | Disabled: Specifies that the service should not be started.                                                                      |
+-------+----------------------------------------------------------------------------------------------------------------------------------+

如果你想获得当前的服务状态,考虑使用sc命令, 或者威盛

答案2

启动类型存储在Start密钥中

可能的值包括:

  • 0——启动
  • 1 - 系统
  • 2 - 自动
  • 3 - 手册
  • 4 - 已禁用

相关内容