AutoIT:为文件夹下面的文件批量改名

以前用Ruby脚本,对于中文,数字结合的文件名,修改名字也不是非常简单,需要修改字符集,可是用autoit来实现,也挺简单的,并且可以替换已有文件名中的汉字部分。

$filepath = "Filewith2000.7月底延期事宜"
if FileExists($filepath) Then
   FileChangeDir($filepath)
   $search = FileFindFirstFile("*.*")
   ; 检查搜索是否成功
   If $search = -1 Then
     ConsoleWrite("No file")
     Exit
   EndIf

   While 1
     $file = FileFindNextFile($search)
     If @error Then
       ExitLoop
     Elseif StringInStr($file,"2013") Then
       $file2 = StringReplace($file,"8", "9")
       ConsoleWrite($file & @LF)
       ConsoleWrite($file2 & @LF)
       DirMove($filepath & "" & $file, $filepath & "" & $file2)
     EndIf
   ;ConsoleWrite($file & @LF)
  WEnd
 ; 关闭搜索句柄
  FileClose($search)
Else
 ConsoleWrite("No file too")
EndIf
原文地址:https://www.cnblogs.com/autotest/p/3262382.html