找回密码
 加入
搜索
查看: 3076|回复: 6

得到某个目录下的所有文件名或一种类型的文件名

  [复制链接]
发表于 2008-5-29 23:44:48 | 显示全部楼层 |阅读模式
怎么编写AUTOIT程序,得到某个目录下的所有文件名或一种类型的文件名(如EXE,BAT,REG等)
发表于 2008-5-29 23:50:16 | 显示全部楼层
可以使用递归遍历,有点复杂.
还有其它的方法...
 楼主| 发表于 2008-5-30 00:02:04 | 显示全部楼层
可以说说吗?
发表于 2008-5-30 00:45:00 | 显示全部楼层
原帖由 czdn 于 2008-5-30 00:02 发表
可以说说吗?

我在udf 函数那个板块里放出了一个也许对你有帮助
标题:发一个按扩展名搜索文件的例子[别的论坛看到的]

[ 本帖最后由 netegg 于 2008-5-30 00:48 编辑 ]
发表于 2008-5-30 10:27:45 | 显示全部楼层
#include<file.au3>
$filelist=_FileListToArray("c:\windows","*.exe",1)
for $i=1 to $filelist[0]
FileWriteLine("files.txt",$filelist[$i])
Next
ShellExecute("files.txt")
发表于 2008-10-22 10:33:43 | 显示全部楼层
哈哈,又看到新的一种方法。。。
发表于 2008-10-22 16:09:30 | 显示全部楼层
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
                                MsgBox(0,0,$current & "\" & $file)
                        EndIf
                EndIf
                If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "."  Or $file <> "..") Then
                        Search($current & "\" & $file, $ext)
               
                EndIf
        WEnd
        Return
EndFunc   ;==>Search
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-16 17:01 , Processed in 0.080152 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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