中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-08 07:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » VBS查找并打开文件的代码,请高手帮我修改一下 查看 672 回复 1
楼 主 VBS查找并打开文件的代码,请高手帮我修改一下 发表于 2009-03-04 03:04 ·  中国 山东 济南 联通
高级用户
★★★
积分 959
发帖 474
注册 2007-10-25 10:40
18年会员
UID 100716
性别 男
状态 离线
VBS查找并打开文件的代码,请高手帮我修改一下,搜索到文件后,点是用D:\Kmplayer Plus\KMPlayer.exe打开,点否继续搜索,点取消退出程序
Function FilesTree(sPath)
Set oFso=CreateObject("Scripting.FileSystemObject")
Set oFolder=oFso.GetFolder(sPath)
Set oSubFolders=oFolder.SubFolders

Set oFiles=oFolder.Files
For Each oFile In oFiles
MSGBOX oFile.Path,vbQuestion+vbYesNoCancel,"打开"

createobject("wscript.shell").run chr(34)&"D:\Kmplayer Plus\KMPlayer.exe"&chr(34) & (oFile.Path)

Next

For Each oSubFolder In oSubFolders
MSGBOX oSubFolder.Path,vbQuestion+vbYesNoCancel,"打开"
FilesTree(oSubFolder.Path)'递归
Next

Set oFolder=Nothing
Set oSubFolders=Nothing
Set oFso=Nothing
End Function

FilesTree("E:\电影") '遍历
2 发表于 2009-03-04 13:19 ·  中国 北京 鹏博士BGP
高级用户
★★★
据说是李先生
积分 609
发帖 400
注册 2008-04-23 15:55
18年会员
UID 116706
性别 男
状态 离线

Function FilesTree(sPath)
Set oFso=CreateObject("Scripting.FileSystemObject")
Set oFolder=oFso.GetFolder(sPath)
Set oSubFolders=oFolder.SubFolders
Set oShell=CreateObject("Wscript.Shell")

Set oFiles=oFolder.Files
For Each oFile In oFiles
Select case MSGBOX(oFile.Path,35,"打开")
case 6 oShell.run chr(34)&"D:\Kmplayer Plus\KMPlayer.exe"&chr(34)&" "&chr(34)&oFile.Path&chr(34)
case 2 wscript.quit
end select
Next

For Each oSubFolder In oSubFolders
FilesTree(oSubFolder.Path)'递归
Next

Set oFolder=Nothing
Set oSubFolders=Nothing
Set oFso=Nothing
End Function

FilesTree("E:\电影") '遍历


[ Last edited by qinchun36 on 2009-3-6 at 01:44 ]
论坛跳转: