vbs如何读取txt内容

来源:百度知道 编辑:UC知道 时间:2024/06/04 21:34:30
vbs如何读取txt内容
txt内容以“,”分割,例如1,2,3,4,5

希望能把1,2,3,4,5分别去到5个变量中去!
请问 VBS如何实现?

option explicit
dim fso,fread,str,strarry,linestr
set fso=createobject("scripting.filesystemobject")
set fread=opentextfile("test.txt",1)
str=fread.readall
fread.close
if str="" then
wscript.echo "file have not any content"
wscript.quit
end if
strarry=split(str,vbcrlf)
for each linestr in strarry
wscript.echo linestr next
set fso=nothing