欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

vbs初学者 高手来

更新时间: 2014-01-05 01:53:20 责任编辑: Author_N1

 

VBS菜鸟求助 高手来
VBScript code
sc create "Kingsoft Antivirus WebShield Service" start= auto binpath= "%cd%\KSWebShield.exe" displayname= "Kingsoft Antivirus WebShield Service"
regsvr32 /s kswbc.dll
net start "Kingsoft Antivirus WebShield Service"
start kwstray.exe /install
start KSWebShield.exe -install
start KSWebShield.exe -start
start kwstray.exe /showtray
taskkill /F /IM KSWebShield.exe /T
taskkill /F /IM kwstray.exe /T
taskkill /F /IM kwsmain.exe /T
net start "Kingsoft Antivirus WebShield Service"
start kwstray.exe /showtray

上面的代码是批处理的,我想把上面的代码改成vbs的来实现。但是好像不对,烦劳高手指点一下。最好是不要像我这样全部调用dos的命令。大概的功能就是:
注册服务-注册组件-开启服务-运行几个文件-结束几个进程-重新开启服务-运行文件

VBScript code
set wshshell=createobject ("wscript.shell") 
aaa=createobject("Scripting.FileSystemObject").GetFolder(".").Path
wshshell.run "sc create Kingsoft Antivirus WebShield Service start= auto binpath= "&aaa&"\KSWebShield.exe displayname= Kingsoft Antivirus WebShield Service"
wshshell.run "regsvr32 /s kswbc.dll"
wshshell.run "sc start Kingsoft Antivirus WebShield Service"
wshshell.run "kwstray.exe /install"
wshshell.run "KSWebShield.exe -install"
wshshell.run "KSWebShield.exe -start"
wshshell.run "kwstray.exe /showtray"
wshshell.run "taskkill /F /IM KSWebShield.exe /T"
wshshell.run "taskkill /F /IM kwstray.exe /T"
wshshell.run "taskkill /F /IM kwsmain.exe /T"
wshshell.run "sc start Kingsoft Antivirus WebShield Service"
wshshell.run "kwstray.exe /showtray"


--参考方法--
估计有两个错误:
1. 你翻译的时候把人家的引号给丢掉了,这个不行的;
2. 批处理是上一条结束之后再进行下一条,run 方法因当注明要等到运行完毕。

改成这样试试:
VBScript code
 
set wshshell=createobject ("wscript.shell")
aaa=createobject("Scripting.FileSystemObject").GetFolder(".").Path
wshshell.run "sc create ""Kingsoft Antivirus WebShield Service"" start= auto binpath= """&aaa&"\KSWebShield.exe"" displayname= ""Kingsoft Antivirus WebShield Service""",0,true
wshshell.run "regsvr32 /s kswbc.dll",0,true
wshshell.run "sc start ""Kingsoft Antivirus WebShield Service""",0,true
wshshell.run "kwstray.exe /install",0,true
wshshell.run "KSWebShield.exe -install",0,true
wshshell.run "KSWebShield.exe -start",0,true
wshshell.run "kwstray.exe /showtray",0,true
wshshell.run "taskkill /F /IM KSWebShield.exe /T",0,true
wshshell.run "taskkill /F /IM kwstray.exe /T",0,true
wshshell.run "taskkill /F /IM kwsmain.exe /T",0,true
wshshell.run "sc start ""Kingsoft Antivirus WebShield Service""",0,true
wshshell.run "kwstray.exe /showtray",0,true

上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 01:53:20
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/2609/
本文WWW.DOC100.NET DOC100.NET版权所有。