menfan 发表于 2009-9-21 13:17:03

ServiceControl.au3和服务名

本帖最后由 menfan 于 2009-9-21 14:01 编辑

#include <ServiceControl.au3>

Dim $nRet

; 开始/停止服务

If _ServiceExists("", "Symantec AntiVirus") Then
      
   MsgBox(4096,'测试服务' , 'Symantec AntiVirus 服务存在!')   
   If _ServiceRunning("", "Symantec AntiVirus") Then
      MsgBox(4096,'测试服务' , 'Symantec AntiVirus 服务运行')
      If _StopService("", "Symantec AntiVirus") Then
         MsgBox(4096,'测试服务' , 'Symantec AntiVirus 服务停止')
      EndIf
   Else
      MsgBox(4096,'测试服务' , 'Symantec AntiVirus 服务停止')
      If _StartService("", "Symantec AntiVirus") Then
         MsgBox(4096,'测试服务' , 'Symantec AntiVirus 服务开始')
      EndIf
   EndIf
Else
   MsgBox(4096,'测试服务' , 'Symantec AntiVirus服务不存在')   
EndIf

已经找到原因,不是ServiceControl.au3的问题,而是服务名的原因引起的,呵呵。

menfan 发表于 2009-9-21 13:17:47

本帖最后由 menfan 于 2009-9-21 14:29 编辑

目前ServiceControl.au3支持带空格的服务名(加双引号即可,另注:SC QUERY可查服务名),但是服务名一定要正确:)呵呵
页: [1]
查看完整版本: ServiceControl.au3和服务名