VBS读取文件时没反应

来源:百度知道 编辑:UC知道 时间:2024/06/20 06:30:50
Dim fso,textf
set fso=createobject("scripting.filesystemobject")
set textf=fso.opentextfile("D:\123.txt")
do while no textf.atendofstream
msgbox textf.readline,,"提示"
loop
textf.close

我在D盘下已经有一个123的文本文件了,但是运行这个脚本没反应呢?
按 孤星_ -先赋值再msgbox现象还是一样的,没有任何反应,甚至在任务管理器里都没有wscript的进程了

readline读取后不会显示出来的,先赋值再msgbox.
另while就判断atendofstream=flase,或用until判断更好.

-----
Dim fso,textf
set fso=createobject("scripting.filesystemobject")
set textf=fso.opentextfile("d:\123.txt")
do until textf.atendofstream
str=textf.readline
msgbox str,,"提示"
loop
textf.close
------

只要把第四行while后面的no改为not就可以了。