【问题标题】:Is there a commandline option to modify service properties?是否有用于修改服务属性的命令行选项?
【发布时间】:2021-12-28 15:36:29
【问题描述】:

我正在编写一个脚本,它应该在两种服务之间切换:打开一个关闭另一个,反之亦然。

最重要的是,我想避免两个服务同时启动,因此我正在考虑修改服务的属性:我想将启动类型从自动修改为禁用,反之亦然.

这可能吗?如何实现?

【问题讨论】:

  • 您是在询问 sc.exe 还是以编程方式?

标签: windows service command-line


【解决方案1】:

我找到了解决方案,使用sc

sc config Own_Server1 start=auto
sc config Own_Server2 start=disabled

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 2014-05-15
    • 2013-10-09
    相关资源
    最近更新 更多