如何通过Delphi禁用服务? [英] How can I disable a service via Delphi?

查看:216
本文介绍了如何通过Delphi禁用服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用通过Delphi启动和停止服务的例程,但是我也需要禁用它们,可以吗?

解决方案 ShellExecute(0,nil,'cmd.exe','sc config'服务名称start = auto,nil,SW_HIDE);
ShellExecute(0,nil,'cmd.exe','sc config'服务名称start = demand,nil,SW_HIDE);


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?

解决方案

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);

这篇关于如何通过Delphi禁用服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆