分享

命令行更改服务启动方式

 周巍的森林 2007-01-08
          大家都知道开启和停止服务要用命令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,分别是对应自动和手动

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多