Board logo

标题: [问题求助] [已解决]vbs怎样处理多个文件类型? [打印本页]

作者: comicguests    时间: 2012-12-20 20:42     标题: [已解决]vbs怎样处理多个文件类型?

  1. Set FSO = CreateObject("Scripting.FileSystemObject")
  2. For Each File in FSO.GetFolder(".").Files
  3.    Ext = FSO.GetExtensionName(File)
  4.    If LCase(Ext) = "mkv" Then RenFiles
  5. Next
  6. MsgBox "OK"
  7. Sub RenFiles()
  8.    Set Re = New RegExp
  9.    Re.Pattern = "(^.*\[)(\d{2})(\].*$)"
  10.    Re.Global = True
  11.    File.Name = Re.Replace(File.Name,"$2") & ".mkv"
  12. End Sub
复制代码
以上是处理mkv的,可不可以同时处理MP4、ass、rmvb?
作者: apang    时间: 2012-12-20 21:15

本帖最后由 apang 于 2012-12-20 21:24 编辑

第4行:
  1. If LCase(Ext) = "mkv" Or LCase(Ext) = "mp4" Or LCase(Ext) = "ass" Or LCase(Ext) = "rmvb" Then RenFiles
复制代码
第12行:
  1. File.Name = Re.Replace(File.Name,"$2") & "." & Ext
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2