更改 windows 服务启动类型的 Vbscript

Vbscript to change windows service startuptype

我正在使用以下命令行代码将我的某些服务的启动类型更改为自动延迟。

sc config *servicename*  start= delayed-auto

有没有办法在 VBscript 中做到这一点?或者上面的命令行可以转换成VBScript吗?

使用Run方法

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "CMD /C sc config *servicename*  start= delayed-auto", 0, True
    Set WshShell = CreateObject("WScript.Shell" ) 
    WshShell.Run chr(34) & "sc.exe"" config *servicename* start=demand""" & Chr(34), 0, false
    Set WshShell = Nothing 

    ' auto--a service automatically started at boot time, even if no user logs on
    ' boot--a device driver loaded by the boot loader
    ' demand--a service that must be manually started (the default)
    ' disabled--a service that can't be started
    ' system--a service started during kernel initialization
    ' delayed-auto ???????????
    ' 0 - hidden, 1 - normal mode 2 - minimized view 3 - expanded view