本帖最后由 apang 于 2013-10-27 16:00 编辑
保存为test.vbs 试试- Set fso = CreateObject("Scripting.FileSystemObject")
- Set file = fso.OpenTextFile("a.txt")
- Do Until file.AtEndofStream
- ar = Split(file.ReadLine,vbTab)
- ReDim Preserve a(20,i)
- For j = 0 to UBound(ar)
- a(j,i) = ar(j) '第i行 第j列
- Next
- i = i + 1
- Loop
-
- For i = 1 to 300
- Set file = fso.OpenTextFile("z" & i & ".txt")
- Do Until file.AtEndofStream
- ar = Split(file.ReadLine,vbTab)
- For j = 0 to UBound(ar)
- If ar(j) <> "" Then ar(j) = Right((CInt(ar(j)) + a(j,i-1)),1)
- Next
- fso.OpenTextFile("s" & i & ".txt",8,true).WriteLine Join(ar,vbTab)
- Loop
- file.Close : Set file = Nothing
- Next
复制代码
|