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:\电影") '遍历
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:\电影") '遍历
