Function to count number of lines in a text file

后端 未结 7 711
栀梦
栀梦 2020-12-29 08:04

Need a function that will accept a filename as parameter and then return the number of lines in that file.

Should be take under 30 seconds to get the count of a 10 m

7条回答
  •  既然无缘
    2020-12-29 08:38

    How to count all lines in the notepad Answers: => Below is the code -

    Set t1=createObject("Scripting.FileSystemObject")
    Set t2=t1.openTextFile ("C:\temp\temp1\temp2_VBSCode.txt",1)
    Do Until t2.AtEndOfStream
    strlinenumber = t2.Line
    strLine = t2.Readline
    Loop
    msgbox strlinenumber
    t2.Close
    

提交回复
热议问题