用命令行怎么改变XP服务的启动方式

来源:百度知道 编辑:UC知道 时间:2024/05/21 21:59:57
比如要把启动类型指定为“自动”,只用系统内置命令

大家都知道开启和停止服务要用命令net start servicename和net stop servicename吧

但是怎么才能在命令行下设置一个服务的启动状态呢?比如说禁用它?

系统自带的东东里可能有,但是我没研究过,我只说pstools里带的psservice命令

在命令行下输入psservice/?命令可以看到使用说明:

Usage: psservice [\\Computer [-u Username [-p Password]]] <cmd> <optns>
Cmd is one of the following:
query Queries the status of a service
config Queries the configuration
start Starts a service
stop Stops a service
restart Stops and then restarts a service
pause Pauses a service
cont Continues a paused service
depend Enumerates the services that depend on the one specified
find Searches for an instance of a service on the network

这是psservice命令的参数列表,但是今天我们用到的是这个列表里没有出现的一个参数: setconfig

比如说要禁用Uninterruptible Power Supply服务(UPS),我们知道它的服务名称是UPS,那么只要输入以下命令:

psservice setconfig ups disabled

就可以把这个服务禁用掉了

其中的disabled可以换成auto和demand,分别是对应自动和手动