mlhaufe

VBScript Fast Line Count

Jul 1st, 2011
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Lines(fileName)
  2.     Dim Shell : Set Shell = CreateObject("WScript.Shell")
  3.     Dim Exec  : Set Exec  = Shell.Exec("find /c /v """" " & filename)
  4.     While Exec.Status = 0
  5.         WScript.Sleep 1
  6.     Wend
  7.     Dim s : s = Split(Exec.StdOut.ReadAll(), " ")
  8.     Lines = CDbl(s(UBound(s)))
  9. End Function
  10.  
  11. WScript.Echo Lines("C:\test\test.txt")
Advertisement
Add Comment
Please, Sign In to add comment