本帖最后由 pcl_test 于 2015-7-9 10:03 编辑
vbs,然并不知道每个txt文件的大小,效率待测- dim fs,str,ext
- str = "ABCDEFGHIJK"
- set fs = CreateObject("Scripting.FileSystemObject")
- set Folder = fs.GetFolder(".")
- fs.CreateFolder ".\处理结果"
- set Files = Folder.Files
- for each file in Files
- ext = LCase(fs.GetExtensionName(file))
- if ext = "txt" then call reT(file.Name,str)
- next
- Msgbox "完成"
-
- function reT(file,str)
- dim f1,f2,txt
- set f1 = fs.OpenTextFile(file, 1)
- set f2 = fs.CreateTextFile(".\处理结果\"+file, 2)
- txt = f1.ReadAll()
- f2.WriteLine replace(txt,str,file)
- f1.Close
- f2.Close
- end function
复制代码
|