保存为vbs,与要修改的TXT放在一起,试试- Set FSO = CreateObject("Scripting.FileSystemObject")
- If Not Fso.FolderExists("New") Then
- FSO.CreateFolder("New")
- End If
- For Each File In FSO.GetFolder(".").Files
- Ext = FSO.GetExtensionName(File)
- If Lcase(Ext) = "txt" Then ModifyText File
- Next
- MsgBox "OK"
-
- Sub ModifyText(F)
- Text = FSO.OpenTextFile(F,1).ReadAll
- A = Split(Text,"G5.1Q1")
- Str = A(0) & "G5.1Q1" & A(1)
- FSO.CreateTextFile("New\"&F.Name,True).Write Str
- End Sub
复制代码
|