找回密码
 加入
搜索
查看: 3268|回复: 11

如果顺序执行一个文件夹中的所有exe?

[复制链接]
发表于 2008-7-4 23:42:57 | 显示全部楼层 |阅读模式
如题,我有一个文件夹是D:\保护程序,
里面有多个不同名字的exe,我想按顺序一个接一个的全部执行,有没有什么方法可以实现我用RUN(“*.exe”)不行。

[ 本帖最后由 douyuan 于 2008-7-9 12:32 编辑 ]
发表于 2008-7-5 07:24:05 | 显示全部楼层
$FilePath = "D:\保护程序"
$searchFile = FileFindFirstFile($FilePath & "\*.exe")
If $searchFile = -1 Then
    MsgBox(0, "错误", "无任何文件或文件夹与指定的搜索字符串匹配")
    Exit
EndIf

While 1
    $file = FileFindNextFile($searchFile)
    If @error Then ExitLoop
    run($FilePath & "\" & $file)
WEnd

FileClose($searchFile)

[ 本帖最后由 xb0x 于 2008-7-5 07:26 编辑 ]
发表于 2008-7-5 08:27:14 | 显示全部楼层
楼上的不能按顺序一个接一个的执行,好象是同时执行.
发表于 2008-7-5 14:47:05 | 显示全部楼层
如此这般
Search("D:\保护程序","exe")
Func Search($current, $ext)
        Local $search = FileFindFirstFile($current & "\*.*")
        While 1
                Dim $file = FileFindNextFile($search)
                If @error Or StringLen($file) < 1 Then ExitLoop
                If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "."  Or $file <> "..") Then
                        If StringRight($current & "\" & $file, StringLen($ext)) = $ext Then
                                RunWait($file,$current & "\")
                        EndIf
                EndIf
                If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "."  Or $file <> "..") Then
                        Search($current & "\" & $file, $ext)
                EndIf
        WEnd
        Return
EndFunc
发表于 2008-7-5 15:08:08 | 显示全部楼层
原帖由 大绯狼 于 2008-7-5 14:47 发表
如此这般
Search("D:\保护程序","exe")
Func Search($current, $ext)
        Local $search = FileFindFirstFile($current & "\*.*")
        While 1
                Dim $file = FileFindNextFile($search)
                If @error Or StringLen($ ...



运行,结果

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-7-5 21:05:07 | 显示全部楼层
用run不行就用runwait呀,后者是等待运行结束的。关于按顺序执行就用FileFindFirstFile配合FileFindNextFile完成。
发表于 2008-7-5 21:38:27 | 显示全部楼层
原帖由 顽固不化 于 2008-7-5 21:05 发表
用run不行就用runwait呀,后者是等待运行结束的。关于按顺序执行就用FileFindFirstFile配合FileFindNextFile完成。


顽固就是能化,行了.呵呵
发表于 2008-7-7 12:13:42 | 显示全部楼层
直接收下了,今天直接把Search函数用到了我的程序中,很省事。多谢!!
 楼主| 发表于 2008-7-9 11:20:27 | 显示全部楼层
好像这样搞还有是点错误
发表于 2008-7-9 22:29:39 | 显示全部楼层
Search函数真的很神吗?
发表于 2011-2-25 12:30:11 | 显示全部楼层
runwait
FileFindFirstFile
FileFindNextFile

这3个函数能够做到~
发表于 2012-4-4 00:23:03 | 显示全部楼层
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 15:25 , Processed in 0.082577 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表