逐行读取txt

时间:2023-03-08 15:34:42

Dim fso, f1, ts, s
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("e:\serverlist.txt", ForReading)
'ts.skipline '跳过一行
do until ts.AtEndOfStream '判断是否到文件末尾

tsline = ts.readline
'tslines = split(tsline,",") '使用,分隔字符串
'ip = tslines(0) '分隔后的第一个字符串
'username = tslines(1)
'userpass = tslines(2)

msgbox tsline
loop
ts.close