本帖最后由 沐月狐 于 2016-5-25 21:20 编辑
求此代码,要搜索所有盘符和所有目录下(最多4层,太深了可能会很慢)找到Tool.ini文件,并获取Tool.ini文件所在目录的完整路径
http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&ptid=25596&pid=318031
根据这个帖子改了下,已经解决了,虽然看不懂什么意思,反正修改后能达到我的需求了#Include <File.au3>
$Drive= DriveGetDrive( "all" )
For $i = 1 to $Drive[0]
Find_folder($Drive[$i])
Next
Func Find_folder($searchdir)
$search = FileFindFirstFile($searchdir & "\*")
If $search = -1 Then return -1
While 1
$file = FileFindNextFile($search)
If @error Then
FileClose($search)
return
ElseIf stringinstr(FileGetAttrib($searchdir & "" & $file),"D") then
If FileExists($searchdir & "" & $file&"\Tool.ini") Then
$FileList=_FileListToArray($searchdir & "" & $file,'Tool.ini',1)
If Not @error Then
For $j=1 To $FileList[0]
MsgBox(0,"文件目录",$searchdir & "" & $file&"")
Next
EndIf
Else
Find_folder($searchdir & "" & $file)
EndIf
EndIf
WEnd
EndFunc
|