Autoit如何搜索文件?
...RT..我需要全盤搜索.....
FileFindFirstFile 不能全盤搜索.....
謝謝大蝦咯! 这个可以全盘搜索.可能你用法不当
回复 2# akmm88 的帖子
請指教..... 用枚举,函数区里有 ........我想要看看函數示範而已......另外枚舉是什麽? 可以看下这个例子
http://www.autoitx.com/forum.php?mod=viewthread&tid=6181&extra=page%3D1
[ 本帖最后由 maker 于 2009-4-4 10:53 编辑 ] ddddddddddd 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 #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 实现方法好多哦,自己搜索一下吧
页:
[1]