阿祥 发表于 2010-1-27 17:02:59

不错,好贴。。

figons 发表于 2010-1-28 17:57:24

楼主的问题解了没有?

wuweixian 发表于 2010-7-14 10:52:56

{:face (55):}谢谢提供源码,精神可加

烤地瓜 发表于 2010-7-19 20:48:57

留个记号!{:face (270):}

saromman 发表于 2010-8-3 13:04:59

楼上的无私奉献精神, 复制代码过来收藏学习了.

menfan1 发表于 2010-8-3 13:44:00

之前我也搜索过建立服务这块内容,有挺多相似的帖子吧呵呵

wanhua8u8 发表于 2010-8-3 14:00:43

留下做个记号,以后用得着

apibits 发表于 2010-8-12 11:01:29

创建服务,并不一定使用这些函数就能成功加载,有些还得在注册表中写入键值,才能成功加载或启动服务。
newx 发表于 2009-11-30 14:42 http://www.autoitx.com/images/common/back.gif


    如果说系统的WMI服务没有启动,那么WMI这样操作服务就无法实现了。比如某些网吧系统。。

xsjtxy 发表于 2010-8-12 15:07:54

本帖最后由 xsjtxy 于 2010-8-12 15:14 编辑

这样,虽然启动的时候会显示失败。但是进程里面已经有了。程序也在工作。不会停止

P版有个贴子用AU3写服务的。以前都可以浏览。现在没阅读权限了。灰常伤心。
#Include<ServiceControl.au3>

If $CmdLine = 0 Then
$m = msgbox(3,"安装卸载","点是安装服务并立即启动服务"&@CRLF&"点否安装服务重启时生效"&@CRLF&"点取消卸载之前安装的服务!")
if $m = 6 or $m = 7 then _CreateService('','服务名称','显示名称',@ScriptFullPath&' autoit')
if $m = 6 then _StartService('','服务名称')
if $m = 2 then
_StopService('','服务名称')
_DeleteService('','服务名称')
endif
Exit
endif

If $CmdLine = "autoit" then
run(@ScriptFullPath&" autoitrun")
exit
endif

IniWrite(@TempDir & "\" & StringReplace(StringReplace(@ScriptFullPath, "\", ""), ":", "") & ".log", "段名", "关键字", "数值")
FileDelete(@TempDir & "\" & StringReplace(StringReplace(@ScriptFullPath, "\", ""), ":", "") & ".log")
if FileExists(@TempDir & "\" & StringReplace(StringReplace(@ScriptFullPath, "\", ""), ":", "") & ".log") then
exit
endif
FileOpen(@TempDir & "\" & StringReplace(StringReplace(@ScriptFullPath, "\", ""), ":", "") & ".log", 2)


While 1
sleep(10)
WEnd

xsjtxy 发表于 2010-8-12 16:54:57

而且用run不用runwait的话。服务失败的速度也很快。不会被写到日志里面去。当然如果手动启动服务的话还是会写失败日志。

58fly 发表于 2010-8-12 21:28:03

AFAN真是个好人
页: 1 [2]
查看完整版本: 请问那个官方的services.au3怎样创建服务呢?急需,多谢!