请问是不是FileFindFirstFile出的问题?如果是怎样解决?
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=d:\my documents\a3\form1.kxf
$Form1_1 = GUICreate("小改名软件", 404, 188, 230, 149)
$Button1 = GUICtrlCreateButton("输入", 16, 24, 81, 33, 0)
$Button2 = GUICtrlCreateButton("输出", 16, 72, 81, 33, 0)
$Group1 = GUICtrlCreateGroup("请选择", 8, 8, 377, 105)
$Label1 = GUICtrlCreateLabel("请选择输入路径", 112, 32, 260, 17)
$Label2 = GUICtrlCreateLabel("请选技输出路径", 112, 72, 260, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button3 = GUICtrlCreateButton("开始", 48, 136, 105, 33, 0)
$Button4 = GUICtrlCreateButton("退出", 224, 136, 113, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$path1 = FileSelectFolder("请选择输入文件夹:", "")
$Label1 = GUICtrlCreateLabel($path1, 112, 32, 260, 17)
Case $Button2
$path2 = FileSelectFolder("请选择输出文件夹:", "")
$Label2 = GUICtrlCreateLabel($path2, 112, 72, 260, 17)
Case $Button3
rename ()
Case $Button4
Exit
EndSwitch
WEnd
func rename ()
$search = FileFindFirstFile($path1&"\*.jpg")
; 检查搜索是否成功
If $search = -1 Then
MsgBox(0, "错误", "无任何文件或文件夹与指定的搜索字符串匹配")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$t = FileGetTime($file, 1)
$file2 = $t[0] & "年" & $t[1] & "月" & $t[2]&"日_"&$t[3]&"点"&$t[4]&"分"&$t[5]&"秒"
MsgBox(0, $file&"改成了 ", $file2)
FileCopy($path1&"\"&$file, $path2&"\"&$file2&".jpg")
WEnd
; 关闭搜索句柄
FileClose($search)
EndFunc
|