专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > vbScript

VBS初学者 高手来

发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
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

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: