Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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