CCTRV 发表于 2009-3-26 12:45:17

Autoit如何搜索文件?

...RT..
我需要全盤搜索.....
FileFindFirstFile 不能全盤搜索.....
謝謝大蝦咯!

akmm88 发表于 2009-3-26 12:48:43

这个可以全盘搜索.可能你用法不当

CCTRV 发表于 2009-3-26 13:21:22

回复 2# akmm88 的帖子

請指教.....

netegg 发表于 2009-3-26 19:13:10

用枚举,函数区里有

CCTRV 发表于 2009-4-3 10:54:14

........
我想要看看函數示範而已......另外枚舉是什麽?

maker 发表于 2009-4-3 11:31:48

可以看下这个例子
http://www.autoitx.com/forum.php?mod=viewthread&tid=6181&extra=page%3D1

[ 本帖最后由 maker 于 2009-4-4 10:53 编辑 ]

yzh016 发表于 2009-7-29 22:07:34

ddddddddddd

menfan1 发表于 2009-7-30 20:14:25

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
ConsoleWrite($current & "\" & $file & @CRLF)
EndIf
EndIf
If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
Search($current & "\" & $file, $ext)
EndIf
WEnd
Return
EndFunc ;==>Search

menfan1 发表于 2009-7-30 20:15:54

#NoTrayIcon

Opt("MustDeclareVars", 1)
#include <Constants.au3>

Local $Drive, $I, $File

$File = InputBox("输入", "输入要查找的文件名:", "", "", 180, 80, -1, -1)
If @error Or $File = "" Then Exit

$Drive = DriveGetDrive("FIXED")

For $I = 1 To $Drive
      Local $foo, $line, $lines
      $foo = Run(@ComSpec & " /c dir /b /s /a " & $File, $Drive[$I] & "\", @SW_HIDE, $STDOUT_CHILD)
      $lines = ""
      While 1
                $line = StdoutRead($foo)
                If @error Then ExitLoop
                $lines &= $line
      WEnd
      If $lines = "" Then
                MsgBox(16, "错误", "在驱动器" & $Drive[$I] & "没有找到要找的文件!", 2)
                ContinueLoop 1
      EndIf
      MsgBox(0, "找到的文件:", $lines)
Next

menfan1 发表于 2009-7-30 20:16:26

实现方法好多哦,自己搜索一下吧
页: [1]
查看完整版本: Autoit如何搜索文件?