- 帖子
- 3151
- 积分
- 6455
- 技术
- 317
- 捐助
- 70
- 注册时间
- 2008-8-3
|
本帖最后由 523066680 于 2014-5-8 12:51 编辑
回复 1# ZeronoFreya
按楼主的代码添加了一部分东西,保存为vbs即可,WIN7 64位,测试过
if wscript.arguments.count=0 then
createobject("wscript.shell").run _
"cmd /c cscript //nologo " &chr(34) &wscript.scriptname &chr(34) & " isme"
wscript.quit
end if
set OUT=wscript.stdout
set INP=wscript.stdin
OUT.write "拖放需要改名的文件夹到此处:"
fold=INP.readline
'以下是楼主的代码
Set FSO = CreateObject("Scripting.FileSystemObject")
For Each File in FSO.GetFolder(fold).Files
Ext = FSO.GetExtensionName(File)
If LCase(Ext) = "txt" Or LCase(Ext) = "doc" Or LCase(Ext) = "ass" Then RenFiles
Next
MsgBox "OK"
Sub RenFiles()
Set Re = New RegExp
Re.Pattern = "(^.*\[)(\d{2})(\].*$)"
Re.Global = True
File.Name = Re.Replace(File.Name,"$2") & "." & Ext
End Sub |
|