How can I disable a service via Delphi?

后端 未结 5 1987
离开以前
离开以前 2021-01-01 21:43

I use a routine that can start and stop services via Delphi but I also need to be able to disable them, is it possible?

5条回答
  •  春和景丽
    2021-01-01 22:27

    ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=disabled', nil, SW_HIDE);
    ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=auto', nil, SW_HIDE);
    ShellExecute(0, nil, 'cmd.exe', 'sc config "the service name" start=demand', nil, SW_HIDE);
    

提交回复
热议问题