• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

VBScript Question

Someone please tell me why this script never exits the Loop PLEASE!

On Error Resume Next

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f, s

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForReading, True)
Do While NOT f.AtEndOfStream
   s = f.readline
   wscript.Echo s
   f.Close
Loop
0
Packerland
Asked:
Packerland
  • 2
1 Solution
 
KJHDI12Commented:

f.Close

should be afte

Loopr
0
 
_ys_Commented:
Swap the last two lines:

Loop
f.Close
0
 
EDDYKTCommented:
Also change ForReading to 1
0
 
EDDYKTCommented:
never mind
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now