在VBS中的wscript.shell对象下的run指令中.怎么才能使它运行所有符合后缀名的程序?

来源:百度知道 编辑:UC知道 时间:2024/06/21 10:41:50
比如..set wsh=createobject("wscript.shell")..
现在在VBS中我想让wsh.run运行所有只要是.exe的程序...请问怎么实现?..
但是你这个是个无限循环啊....

'运行当前目录下所有exe,不包括子目录。
dim wsh,fso,f,p
set wsh=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
For Each f In fso.GetFolder(".").Files
p = f.Path
If LCase(fso.GetExtensionName(p)) = "exe" Then
wsh.run """" & p & """"
End If
Next

'-------------------------------
'不是无限循环,只是遍历文件

for 循环怎么能是无限循环呢?