本帖最后由 pcl_test 于 2015-8-4 15:35 编辑
VBS | Dim fso,File1,File2,File3,MyArray(),arr | | Set fso = CreateObject("Scripting.FileSystemObject") | | Set File1= fso.OpenTextFile(".\$DG.txt", 1 , True) | | Set File2= fso.OpenTextFile(".\NEW_DG.txt", 1 , True) | | Set File3 = fso.CreateTextFile(".\结果.txt", 2 ,False) | | i=0 | | s="" | | Do While File1.AtEndOfStream <> True | | ReDim Preserve MyArray(i) | | MyArray(i)=File1.ReadLine | | i=i+1 | | Loop | | File1.Close | | Do While File2.AtEndOfStream <> True | | t=File2.ReadLine | | For j=0 To UBound(MyArray) | | arr=Split(MyArray(j)," ") | | If t = arr(0) Then | | s=s&MyArray(j)&vbCrLf | | End If | | Next | | Loop | | File3.WriteLine s | | File2.Close | | File3.Close | | Msgbox "完成"COPY |
|