难道要这个?
kevinch 发表于 2011-7-18 20:20 http://www.autoitx.com/images/common/back.gif
对.就是这个..谢谢 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
$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 ;==>
回复 14# 夜猫猫
不要路径全名?把返回值改下就行了 Local $Str = 'C:\Windows\System32\cmd.exe'
Local $Test = StringRegExpReplace($str, '.*?\\?([^\\]+)\\[^\\]+$', '\1')
MsgBox(0, '', '原字符串' & @LF & $Str & @LF & @LF & '提取结果' & @LF & $Test) 难道要这个?
kevinch 发表于 2011-7-18 20:20 http://www.autoitx.com/images/common/back.gif
这个是最简单的 afan
StringRegExpReplace($str, '.*?\\?([^\\]+)\\[^\\]+$', '\1')
中的'\1'代表什么?
能解释下这个正则吗?
页:
1
[2]