启动禁用的 Windows 服务?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2768125/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:24:37  来源:igfitidea点击:

Start a disabled windows service?

windowsnetworkingwindows-services

提问by Nevin Mathai

How do I start a disabled windows service from command line?

如何从命令行启动禁用的 Windows 服务?

NET START "Service" doesn't work on disabled services

NET START“服务”对禁用的服务不起作用

采纳答案by Andrey

You can use sc.exeutility to enable the service and optionally start it as well.

您可以使用sc.exe实用程序来启用该服务,也可以选择启动它。

To enable a service you need to set any start option except disabled:

要启用服务,您需要设置除禁用之外的任何启动选项:

sc.exe config [ServiceName] start= [option]

start= {boot | system | auto | demand | disabled | delayed-auto}

Specifies the start type for the service.

boot - Specifies a device driver that is loaded by the boot loader.

system - Specifies a device driver that is started during kernel initialization.

auto - Specifies a service that automatically starts each time the computer is restarted and runs even if no one logs on to the computer.

demand - Specifies a service that must be started manually. This is the default value.

delayed-auto - Specifies a service that starts automatically a short time after other auto services are started.

开始= {启动| 系统| 汽车 | 需求| 禁用 | 延迟自动}

指定服务的启动类型。

boot - 指定由引导加载程序加载的设备驱动程序。

system - 指定在内核初始化期间启动的设备驱动程序。

auto - 指定每次计算机重新启动时自动启动并运行的服务,即使没有人登录计算机。

需求 - 指定必须手动启动的服务。这是默认值。

delay-auto - 指定在其他自动服务启动后不久自动启动的服务。

Then you can manually run it by executing:

然后你可以通过执行手动运行它:

sc.exe start [ServiceName]

回答by mkb

open command line(cmd.exe) and use this:

打开命令行(cmd.exe)并使用这个:

sc config "ServiceName" start= auto

Becareful, it's not start = autoor start=autoor start =auto.

Becareful,这不是start = autostart=autostart =auto