584
Main
Sub Main()
Dim fso, f1, ts, s
Const ForReading = 1
Set fso = CreateObject(“Scripting.FileSystemObject”)Set f = fso.GetFolder(“C:\Users\海军\Desktop\JUNFAN”)
Set fc = f.FilesFor Each f1 in fc
Set ts = fso.OpenTextFile(f1.name , ForReading)
s = ts.ReadLine
do While left(s,3)<>”To:” and ts.AtEndOfStream <> True
s = ts.ReadLine
‘ts.Skipline
loopts.Close
WriteFiles(s)
‘Msgbox(f1.name & s)
NextEnd Sub
Sub WriteFiles(T)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set f = fso.OpenTextFile(“out.txt”, ForAppending, True)
f.Write T
f.Writeline
f.Close
End Sub
============================
保存为.vbs结尾的文件,运行