本帖最后由 夜猫猫 于 2011-7-18 21:09 编辑
难道要这个?
kevinch 发表于 2011-7-18 20:20
对.就是这个..谢谢 kevinch
查找文件夹中所有的EXE文件.返回文件所在的目录名,写入INI文件中
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 564, 227, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 88, 72, 233, 21)
$Button1 = GUICtrlCreateButton("...", 336, 72, 57, 25)
$Button2 = GUICtrlCreateButton("Button1", 232, 144, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$file = FileSelectFolder("选择文件夹.", "")
GUICtrlSetData($Input1,$file)
Case $Button2
_Seachfilebyext(GUICtrlRead($Input1), 'exe')
EndSwitch
WEnd
Func _Seachfilebyext($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
$Filepath = $current & "\" & $file
;msgBox(0, '', $Filepath)
$a_Arr=StringSplit($Filepath,"\")
$fileinfo = $a_Arr[UBound($a_Arr)-2]
$u = $fileinfo&"="&$Filepath
$h=FileWrite(@ScriptDir&"\log.ini",$u& @CRLF)
EndIf
EndIf
If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
_Seachfilebyext($current & "\" & $file, $ext)
EndIf
WEnd
EndFunc ;==>
|