Command line 用于更改windows服务启动类型的Vbscript

Command line 用于更改windows服务启动类型的Vbscript,command-line,vbscript,windows-services,Command Line,Vbscript,Windows Services,我正在使用下面的命令行代码将我的一些服务的启动类型更改为自动延迟 sc config *servicename* start= delayed-auto 有没有办法在VBscript中执行此操作?或者可以将上述命令行转换为VBScript吗?使用RunMethod Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "CMD /C sc config *servicename* start= delayed-a

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

sc config *servicename*  start= delayed-auto

有没有办法在VBscript中执行此操作?或者可以将上述命令行转换为VBScript吗?

使用
Run
Method

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