WinServ [v1.0]

作者: Hardeep 最近更新时间: nonexistent


WinServ function can be used to start, stop or query(running status) a windows service on local or a remote computer. Dialogs provide visual feedback when starting/stopping a service or when an error occurs. Usage documentation is included in the library.

WinServ(ServiceName, Task="", Silent=False, Computer="")
WinServ_ErrMsg(Title, ServiceName, Task="", Silent=False, Dummy="")

关于函数的参数和返回值, 请参阅其源码.

备注

It is not stdlib conform, because global variables are in use.

This library lacks an external documentation, but every function is detailed described in the souce.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=21975

许可

此函数(集)是基于 Public Domain 许可的开源项目. 想了解许可详情, 请参见 Hardeep_WinServ-license.txt

示例

; #Include WinServ.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

;Start the Task Scheduler service by using its Service Name
MsgBox % WinServ("Schedule", True) ;Returns True if started successfully.

; More Examples:
/*
;Start the Task Scheduler service by using its Service Name
WinServ("Schedule", True) ;Returns True if started successfully.

;Stop the Task Scheduler service by using its Display Name
WinServ("Task Scheduler", False) ;Returns True if stopped successfully.

;Start the Windows Time service silently
WinServ("Windows time", True, True) ;No popups

;Start the Task Scheduler service on remote computer name ZOMBIE
WinServ("Schedule", True, False, "ZOMBIE") ;Returns True if started successfully.

;Check if the WebClient service is running
If WinServ("WebClient")
{   MsgBox, WebClient is up & running
   ;Do Something
}

;Toggle the DNS Client service
WinServ("DNS Client", WinServ("DNS Client") ? False : True)
*/